eZ Community » Forums » Developer » Site access in URL

Site access in URL

Site access in URL

Thursday 04 December 2014 2:17:07 pm - 2 replies


I'm using eZ 5.3

I'm creating a bilingual website, with 2 siteaccesses (one for each language). How can i force the siteaccess to be present in generated urls for my custom actions?


So far, I've been usign the _locale parameter in all of my routes, and then I use that locale to get the site access




    path: /{_locale}/seach

Is there anyway to create routes like that (without having to explicitely specify the site access parameter each time, from twig or from php) ?


    path: /{_siteaccess}/seach


The only solution I came up with so far is creating a custom twig function, and using it to generate the urls instead of using the native url/path functions.


Modified on Thursday 04 December 2014 2:18:29 pm by David B

Saturday 06 December 2014 4:50:38 pm

Hi David

Actually it should be automatic... The default Symfony router is overriden by eZ kernel to add siteaccess support, so basically have nothing to do. One example is the login route.

Monday 08 December 2014 9:57:09 am

Hello Jerôme,


Thanks for your reply. I got confused because I was only checking pages on the default site access.

It seems that the site access is added to the generated urls only from pages which already have the site access in their URL.


I've got 2 siteaccesses: fre (default) and eng

When I navigate to the site's homepage (http://mysite.com), then the siteaccess is not injected in generated links.

The site access is added to the generated links only if I navigate to http://mysite.com/fre or http://mysite.com/eng


Maybe it's not a problem, but I'm just worrying that I might end up with some urls that have the default site access included, and some which don't.


Thanks again

Modified on Monday 08 December 2014 1:31:40 pm by David B


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

36 542 Users on board!

Forums menu

Proudly Developed with from