【问题标题】:Request exceeded the limit of 10 internal redirects due to probable configuration error...?由于可能的配置错误,请求超出了 10 个内部重定向的限制...?
【发布时间】:2013-10-23 12:26:58
【问题描述】:

我在 apache 错误日志中收到此错误:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

我的.htaccess 文件如下所示:

AddDefaultCharset UTF-8
RewriteEngine on

RewriteRule    ^view/([A-Za-z0-9-]+)/?$    view.php?id=$1    [NC,L]
RewriteRule    ^report/([A-Za-z0-9-]+)/?$  report.php?id=$1    [NC,L]
RewriteRule    ^verifyAccount/([A-Za-z0-9-]+)/?$ verifyAccount.php?hash=$1 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

RewriteCond %{HTTP_HOST} !^www.nitrobit.net$ [NC]
RewriteRule ^(.*)$ http://www.nitrobit.net/$1 [L,R=301]

我用谷歌搜索了这个问题,我看到一些人的解决方案是在 htaccess 文件中添加这一行:RewriteBase /。我做到了,错误仍然存​​在。

解决办法是什么?非常感谢你,对不起我的英语

【问题讨论】:

  • 一遍又一遍地找出匹配的规则(将它们逐一注释,直到错误消失)。过去在特定情况下,我遇到了最后一条规则的麻烦(我相信当存在具有特定名称而不是文件的目录时,%{REQUEST_FILENAME}\.php -f 将返回 true。我会添加一个额外的条件URI 不能以 .php 结尾。

标签: php .htaccess configuration


【解决方案1】:

重新排序规则并添加附加条件:

AddDefaultCharset UTF-8
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.nitrobit\.net$ [NC]
RewriteRule ^(.*)$ http://www.nitrobit.net/$1 [L,R=301]

RewriteRule ^view/([a-z0-9-]+)/?$ view.php?id=$1 [QSA,NC,L]
RewriteRule ^report/([a-z0-9-]+)/?$ report.php?id=$1 [QSA,NC,L]
RewriteRule ^verifyAccount/([a-z0-9-]+)/?$ verifyAccount.php?hash=$1 [QSA,NC,L]

# if it has not been rewritten then find a .php handler
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php [L]

【讨论】:

  • 还是有这个问题
  • 现在我有这个错误 - File does not exist: /home/nitrobit/domains/nitrobit.net/public_html/view, referer:http://www.nitrobit.net/view/4LrsSAyev
猜你喜欢
  • 2012-05-03
  • 2010-12-09
  • 2017-09-23
  • 2014-01-26
  • 2020-05-05
相关资源
最近更新 更多