2016-09-17 55 views
0

我有一个Symfony项目(example.com)并添加了一个指向同一应用程序的子域(demo.example.com)。该子域提供了一个内部服务器错误。错误日志显示:AH00124:由于可能的配置错误,请求超出了10个内部重定向的限制。如果需要,使用'LimitInternalRecursion'来增加限制。Symfony中的子域给出内部服务器错误

我设置运我的routing.yml是这样的:

account_homepage: 
    path: /
    host:  "{subdomain}.{domain}" 
    defaults: 
     _controller: AppBundle:Default:loginRedirect 
    requirements: 
     subdomain: demo|myaccount 

homepage: 
    path: /
    defaults: 
     _controller: AppBundle:Default:loginRedirect 

基于对How to Match a Route Based on the Host的Symfony的文档。 类似的问题似乎都指向.htaccess文件,但我用附带的Symfony htaccess的文件:

<IfModule mod_authz_core.c> 
    Require all denied 
</IfModule> 
<IfModule !mod_authz_core.c> 
    Order deny,allow 
    Deny from all 
</IfModule> 

什么是去得到子域在我的项目工作的方式吗?

+1

这是网络服务器日志,你没有粘贴代码中最重要的部分:你如何设置子域名。 – malcolm

+0

我在DirectAdmin中设置了子域。在routing.yml中添加子域名,假设这将是一条路。 – zef

+1

我通过hiawatha webserver测试了你的配置,一切正常。请注意,要将路由与“{domain}”占位符相匹配,您必须将'domain'添加到'requirements'设置。 – malcolm

回答

0

将DirectAdmin中的子域更改为Domain Pointer,以便subdomain.example.com成为example.com的别名,这是我的项目的解决方案。