Php Symfony3子域重定向

Php Symfony3子域重定向,php,mod-rewrite,subdomain,yaml,symfony,Php,Mod Rewrite,Subdomain,Yaml,Symfony,我有一个进入Symfony3应用程序主页的域,例如: http://www.domain.ext/ => /app.php/ http://subdomain.domain.ext/ => /app.php/path/for/subdomain/ http://subdomain.domain.ext/otherpath/ => /app.php/path/for/subdomain/otherpath/ 但我希望将子域“无形重定向”(如mod_rewrite)到我的应用程

我有一个进入Symfony3应用程序主页的域,例如:

http://www.domain.ext/ => /app.php/
http://subdomain.domain.ext/ => /app.php/path/for/subdomain/
http://subdomain.domain.ext/otherpath/ => /app.php/path/for/subdomain/otherpath/
但我希望将子域“无形重定向”(如mod_rewrite)到我的应用程序中的另一个路径,例如:

http://www.domain.ext/ => /app.php/
http://subdomain.domain.ext/ => /app.php/path/for/subdomain/
http://subdomain.domain.ext/otherpath/ => /app.php/path/for/subdomain/otherpath/
我已经使用routing.yml尝试捕获(动态!)子域:

redirect_subdomain:
   path: /
   host: "{subdomain}.{domain}"
   defaults:
      _controller: AppBundle:Redirecting:subdomain
      domain: '%domain%'
      subdomain: www
   requirements:
      domain: '%domain%'
      subdomain: !(local|www)
他从未达到控制器功能。 我已将此页面用作参考:

我忘记什么了吗?我是否仍然需要在php或yml文件中的其他地方定义子域以使其工作