如何使Symfony 3的多个网站具有相同的路由

时间:2017-11-20 17:21:26

标签: php symfony routing symfony-3.3

在某些情况下,我尝试使用symfony进行多站点管理,并使用相同的路由:


fos_user:
    resource:"@FOSUserBundle/Resources/config/routing/all.xml"
fos_js_routing:
    resource:"@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
admin_site:
    resource:"@AppBundle/Controller/Admin"
    type: annotation
site_1:
    resource:"@AppBundle/Controller"
    type: annotation
    host: www.site1.com
site_2:
    resource:"@AppBundle/Controller"
    type: annotation
    host: www.site2.com
site_2:
    resource:"@AppBundle/Controller/Site2Addon"
    type: annotation
    host: www.site2.com

但它无法正常工作......最后一次配置会覆盖网址。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题:Multiple routes with multiple domains

路由名称和资源路径都必须是唯一的。您的资源"@AppBundle/Controller"和您的路线名称site_2不是唯一的。