在我们的开发服务器上克隆 git 存储库后,我在 Apache 日志中收到以下错误消息;
由于可能的原因,请求超出了 10 个内部重定向的限制 配置错误。使用"限制内部递归"来增加 如有必要,请限制。使用"日志级调试"获取回溯。
下面复制了 2x .htaccess;
Webroot .htaccess (位于projectRoot/webroot/)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /apply/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
应用程序 .htaccess (位于 projectRoot/)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /apply/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
其他答案说将RewriteBase
更改为/
,但这对我来说不是一个选择,因为我需要它/apply/
。其他一些答案指出RewriteRule
是问题所在,但是删除这些答案并不能解决问题。
您需要排除要重写的目标:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /apply/
RewriteRule ^$ webroot/ [L]
RewriteCond %{REQUEST_URI} !^/webroot/
RewriteRule (.*) webroot/$1 [L]
</IfModule>
否则,您将收到重写循环错误,因为/webroot/也与模式 (.*) 匹配。