This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Same siteaccess and folder name

Same siteaccess and folder name

Same siteaccess and folder name

Monday 27 April 2015 12:35:41 pm - 3 replies

I am using ezpublish 4.7. For example my website URL is I have a siteaccess named "topptur" so the URL is showing the topptur site, but in the recent time, I have added one folder named "topptur".

I am able to access all the folder by hitting: (When there is no match with folder name and siteaccess name)

But when I hit the URL, it takes me to the siteacess instead of the folder page.

But I want page to take me to the folder page.

Monday 27 April 2015 5:19:57 pm

Hello Jyotirmoy,

Then answer to your problem will be found by adding custom mod_rewrite rules into your virtual host configuration! Mod rewrite rules are processed before eZ handles a request and as such override eZ by default. 

I would place your custom mod_rewrite rules near the top of the default eZ Publish virtual host mod_rewrite rules.

Here is an example which will work for you. I have thoroughly tested these rules before sharing:

RewriteRule ^/topptur(/$|\.) /extension/your-custom-extension-name/static/topptur/index.html [NC,L]
RewriteRule ^/topptur(.*) /extension/your-custom-extension-name/static/topptur$1 [NC,L]

The first rule provides for /topptur or /topptur/ requests to go to a default index.html file (a standard convention), though you could point it to any file in your own custom rules.

The second rule is a fall back (the order of these rules do matter) which directs all requests which do not match the first rule to then expect to be matching the remaining parts of the uri (say a foobar.html file) to a file which exists on the file system (this is commonly used for non-index pages and static resources like css, images or other files).

Please remember that you should not put any folder or file within the eZ Publish root directory.

Instead you should place these additions into an extension and write mod_rewrite rules to dynamically point requests to /topptur to extension/your-custom-extension-name/static/topptur which is what I have done in the above example mod_rewrite rules.

This is both simple to do and makes upgrades much simpler (long term). Please help support to end kernel hacking and keep our eZ Publish root directories clean happy.gif Emoticon

I hope this helps!


Wednesday 29 April 2015 12:23:19 pm

Hi Heath,

Thanks for your reply. Probably the issue description is a bit confusing. I added the folder from admin end. It is a folder class. And some items inside that folder from admin end. I have an URL to access any folder added by the admin user. For example: If I added a folder from admin named "topptur", then it will be accessible via:

But on ezpublish, the siteaccess are also accessible using the siteacess name, for example:<siteacess_name>

But now I have a folder from admin end and a siteacess with the same name.

I think the problem will be solved if we can stop the URL with that specific siteaccess. For example if we can stop:

for the topptur siteaccess not by the RewriteRule but by the eZsystem

*Not for all siteacess, only one specific*

Wednesday 29 April 2015 2:07:13 pm

Hello Jyotirmoy,

Apologies for my mistake, lol, let's hope that answer can help someone else in the distant future big-smile.gif Emoticon

I tried to recreate the situation you describe and found that the following settings solved the problem for me.

From: settings/override/site.ini.append.php


Remember to clear ini caches before testing

Note: The HostMatchMapItems and MatchOrder part 'host' are not required for this solution just recommended. You only need the MatchOrder setting 'host_uri' before the 'uri' part and HostUriMatchMapItems settings array content.

Realize that with the above configuration you will need to access the folder content via a more specific uri. This worked for me:

This is just the trade off for using conflicting siteaccess name and folder names.

This is just one reason why to always name siteaccess so uniquely that they can not conflict with content uri(s) and / or to use host based siteaccess matching only.

I hope this helps!


Modified on Wednesday 29 April 2015 2:08:07 pm by // Heath


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from