Request exceeded the limit of 10 internal redirects due to probable configuration error

前端 未结 4 961
再見小時候
再見小時候 2020-12-05 00:01

I\'m getting the following error in my CakePHP application:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use \'LimitInter

相关标签:
4条回答
  • 2020-12-05 00:06

    This error occurred to me when I was debugging the PHP header() function:

    header('Location: /aaa/bbb/ccc'); // error
    

    If I use a relative path it works:

    header('Location: aaa/bbb/ccc'); // success, but not what I wanted
    

    However when I use an absolute path like /aaa/bbb/ccc, it gives the exact error:

    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.

    It appears the header function redirects internally without going HTTP at all which is weird. After some tests and trials, I found the solution of adding exit after header():

    header('Location: /aaa/bbb/ccc');
    exit;
    

    And it works properly.

    0 讨论(0)
  • 2020-12-05 00:20

    I just found a solution to the problem here:

    http://willcodeforcoffee.com/2007/01/31/cakephp-error-500-too-many-redirects/

    The .htaccess file in webroot should look like:

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

    instead of this:

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /projectname
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
    </IfModule>
    
    0 讨论(0)
  • 2020-12-05 00:27

    i solved this by http://willcodeforcoffee.com/2007/01/31/cakephp-error-500-too-many-redirects/ just uncomment or add this:

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

    to your .htaccess file

    0 讨论(0)
  • 2020-12-05 00:30
    //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]
    
    0 讨论(0)
提交回复
热议问题