Symfony2子域路由 - 不同的捆绑包

Asc*_*rer 8 php symfony

编辑 现在有可能在symfony 2.2中这样做

PlatformFooBundle:
    resource: "@PlatformFooBundle/Resources/config/routing.php"
    domain: foo.testdomain.com

PlatformBarBundle:
    resource: "@PlatformBarBundle/Resources/config/routing.php"
    domain: bar.testdomain.com

PlatformBazBundle:
    resource: "@PlatformBazBundle/Resources/config/routing.php"
    domain: baz.testdomain.com
Run Code Online (Sandbox Code Playgroud)

您也可以使用域中的参数

编辑过

在将其标记为重复之前,请继续阅读

http://www.craftitonline.com/2011/08/symfony2-locale-on-subdomains-not-on-the-url-path/

我读过这篇文章,但它并没有帮助我做我想做的事情.

我有3个不同的应用程序在相同的域名上运行,具有单独的子域名.目前,他们都在自己的symfony安装中运行,我想摆脱它.

foo.testdomain.com
bar.testdomain.com
baz.testdomain.com
Run Code Online (Sandbox Code Playgroud)

每个都使用不同的捆绑

PlatformFooBundle
PlatformBarBundle
PlatformBazBundle
Run Code Online (Sandbox Code Playgroud)

他们每个人都有自己的路线定义.

基本上,我想要的是这个

PlatformFooBundle:
    resource: "@PlatformFooBundle/Resources/config/routing.php"
    subdomain: www|devwww

PlatformBarBundle:
    resource: "@PlatformBarBundle/Resources/config/routing.php"
    subdomain: bar|devbar

PlatformBazBundle:
    resource: "@PlatformBazBundle/Resources/config/routing.php"
    subdomain: baz|devbaz
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

Mun*_*Das 6

正在讨论添加此功能.

  • 如果有人正在读这个,它已经在Sf2.2上了 (6认同)