eZ Platform Discussions

Define route by siteaccess

I’m wondering if is it possible to define tow routes having same path, in wish way the first route works on the first siteaccess and the second one works on the second.

For Example:

Imagine we have 2 siteaccess: site_1 and site_2

Under routing.yml we have this 2 routing configurations:

site_1_bundle.sitemap:
    path:       /sitemap.xml
    controller: Site1Bundle\Controller\SitemapController::index
site_2_bundle.sitemap:
    path:       /sitemap.xml
    controller: Site2Bundle\Controller\SitemapController::index

Hi,

When it comes to SiteAccess system you need to be aware that Symfony is not at all aware about it, it’s a pure eZ feature.

So that means any Symfony feature like routing or service definitions or any pure config by symfony or third party symfony bundles won’t know about it.

So you can try having just one route definition and use eZ parameters (i.e.: $sa_parameter$) to pass to controller:, however I’m unsure if that will work or if Symfony will throw on it. Otherwise maybe rewrite the url on web server level depending on hostname would be another way to approach it.

André