【问题标题】:Request exceeded the limit of 10 internal redirects - .htaccess请求超出了 10 个内部重定向的限制 - .htaccess
【发布时间】:2016-02-17 12:44:21
【问题描述】:

在我们的开发服务器上克隆 git 存储库后,我在 Apache 日志中收到以下错误消息;

请求超出了 10 次内部重定向的限制,因为可能 配置错误。使用“LimitInternalRecursion”来增加 必要时限制。使用“LogLevel debug”获取回溯。

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 是问题所在,但是删除这些并不能解决问题。

【问题讨论】:

    标签: php apache .htaccess


    【解决方案1】:

    您需要排除要重写的目标:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /apply/
        RewriteRule ^$ webroot/ [L]
        RewriteCond %{REQUEST_URI} !^/webroot/
        RewriteRule    (.*) webroot/$1    [L]
    </IfModule>
    

    否则会出现重写循环错误,因为 /webroot/ 也匹配模式 (.*)

    【讨论】:

      猜你喜欢
      • 2013-06-07
      • 2013-10-04
      • 2019-03-08
      • 2018-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-25
      • 2015-11-18
      相关资源
      最近更新 更多