Symfony2 Routing - route subdomains

后端 未结 6 996
半阙折子戏
半阙折子戏 2020-11-29 19:13

Is there a way to set up hostname based routing in Symfony2?

I didn\'t find anything about this topic in the official documentation.
http://sy

6条回答
  •  广开言路
    2020-11-29 20:10

    Just to point out that this is now added in Symfony v2.2 - http://symfony.com/doc/master/components/routing/hostname_pattern.html.

    mobile_homepage:
        path:     /
        host:     m.{domain}
        defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage }
        requirements:
            domain: %domain%
    
    homepage:
        path:  /
        defaults: { _controller: AcmeDemoBundle:Main:homepage }
    

提交回复
热议问题