由于PHP站点上可能存在配置错误,请求超出了10个内部重定向的限制

时间:2015-02-25 16:13:34

标签: php apache .htaccess

我有一个名为src的文件夹。在此文件夹中,如果找不到文件,则会有.htaccess个文件重写对index.php的所有请求:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

这用于类似REST的API。但是,我在frontend文件夹中也有一个文件夹src,就像名字所说的那样,它是一个前端。

该网站没有问题,但Apache日志仍然说:

  

由于可能的配置错误,请求超出了10个内部重定向的限制。如有必要,使用'LimitInternalRecursion'增加限制。使用“LogLevel debug”获取回溯。

这可能是什么问题?

修改
当我设置LogLevel debug时,我收到以下消息

[Wed Feb 25 17:58:15 2015] [debug] core.c(3116): [client 178.200.171.1] r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] core.c(3122): [client 178.200.171.1] redirected from r->uri = /js/ie-emulation-modes-warning.js, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [debug] mod_deflate.c(700): [client 178.200.171.1] Zlib: Compressed 634 to 390 : URL /var/www/projectname/htdocs/src/index.php, referer: http://projectname.com/home.php
[Wed Feb 25 17:58:15 2015] [error] [client 178.200.171.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit

这听起来对任何人都很熟悉吗?

1 个答案:

答案 0 :(得分:0)

如果您尝试使用src文件夹,可以尝试将RewriteBase添加到src文件夹中的htaccess规则。

RewriteEngine on
RewriteBase /src/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /src/index.php [L]