Symfony2 Routing - route subdomains

后端 未结 6 992
半阙折子戏
半阙折子戏 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 19:59

    There is a plugin for Symfony 1.2 that adds this functionality. The code is only a few hundred lines in a single file and shouldn't be too diffcult to port to Symfony 2. But the documentation from Sensio isn't quite there yet.

    You could also not include the subdomain in the route and fetch the domain from the controller and process it there. I think it's this method: getHost()

提交回复
热议问题