Symfony2 Routing - route subdomains

后端 未结 6 978
半阙折子戏
半阙折子戏 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:08

    I assume that subdomain routing in symfony2 is process of choose defined controller in according to subdomain part of hostname, and session variable is not help to resolve defined controller.

    I set request attribute: _controller, in kernel listener like this

    $request->attributes->set('_controller','AcmeBundle:Demo:main');
    

    This is help to route to defined controller, but I lose debug profiler in dev environment, still I can not detect a cause

提交回复
热议问题