Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 由于可能的配置错误,请求超出了10个内部重定向的限制_Apache_Cakephp - Fatal编程技术网

Apache 由于可能的配置错误,请求超出了10个内部重定向的限制

Apache 由于可能的配置错误,请求超出了10个内部重定向的限制,apache,cakephp,Apache,Cakephp,我的CakePHP应用程序中出现以下错误: 由于可能的配置错误,请求超出了10个内部重定向的限制。如有必要,使用“LimitInternalRecursion”增加限制。使用“LogLevel debug”获取回溯跟踪。参考: 根文件夹中的My.htaccess如下所示: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*

我的CakePHP应用程序中出现以下错误:

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

根文件夹中的My.htaccess如下所示:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

重新启动发动机
重写规则^$app/webroot/[L]
重写规则(*)app/webroot/$1[L]
在应用程序文件夹中:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

重新启动发动机
重写规则^$webroot/[L]
重写规则(.*)webroot/$1[L]
在webroot文件夹中:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /projectname
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

重新启动发动机
重写库/项目名
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$index.php?url=$1[QSA,L]
我遵循本教程:


我刚刚在这里找到了问题的解决方案:

webroot中的.htaccess文件应如下所示:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$index.php?url=$1[QSA,L]
与此相反:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /projectname
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

重新启动发动机
重写库/项目名
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$index.php?url=$1[QSA,L]

在调试PHP()函数时发生此错误:

header('Location: /aaa/bbb/ccc'); // error
如果我使用相对路径,它会工作:

header('Location: aaa/bbb/ccc'); // success, but not what I wanted
但是,当我使用像
/aaa/bbb/ccc
这样的绝对路径时,它给出了确切的错误:

由于可能的原因,请求超出了10个内部重定向的限制 配置错误。使用“LimitInternalRecursion”增加 必要时限制。使用“日志级别调试”获取回溯

看起来header函数在内部重定向而根本不使用HTTP,这很奇怪。经过一些测试和尝试,我找到了在header()之后添加exit的解决方案:

它工作正常。

我通过
//Just add 

RewriteBase /
//after 
RewriteEngine On

//and you are done....

//so it should be 

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
只需取消注释或添加以下内容:

RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

在cake 2.4.1的.htaccess文件中,.htaccess是文件夹中包含应用程序、库、插件、供应商的文件;不是app/webroot。还有一个重要的更改是添加
RewriteBase/
。。。htaccess的其他部分可能不匹配,这很好。很好的解决方案是。。。我在我的codeigniter centos 6环境中遇到了这种情况,谢谢。您将如何为Windows解决此问题?我可以确认,从2016年1月23日起,这一切正常。谢谢我的.htaccess以前是:
RewriteRule上的RewriteEngine^(.*)$public/$1[L]
我只需在我的.htaccess中取消对这行“RewriteBase/”的注释,谢谢!!
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]