【发布时间】:2016-09-17 12:26:19
【问题描述】:
我有一个 Symfony 项目 (example.com) 并添加了一个指向同一个应用程序的子域 (demo.example.com)。子域给出内部服务器错误。错误日志显示:AH00124:由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,使用“LimitInternalRecursion”增加限制。
我这样设置我的 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>
让子域在我的项目中工作的方法是什么?
【问题讨论】:
-
这是网络服务器日志,您没有粘贴最重要的代码部分:如何设置子域。
-
我在 DirectAdmin 中设置了子域。在 routing.yml 中添加子域,假设这是要走的路。
-
我通过 hiawatha 网络服务器测试了您的配置,一切正常。请注意,要将路由与
{domain}占位符匹配,您必须将domain添加到requirements设置。 -
我在需求设置中添加了域。事情在本地工作,但不在生产中。通过 DirectAdmin 创建子域会在 public_html 中创建一个具有子域名称的子文件夹,并且其中有一个索引文件。我怀疑这与错误有关?
标签: .htaccess subdomain symfony internal-server-error