Error 500 Request exceeded the limit of 10 internal redirects

2

I have a problem with htaccess

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.10 (Ubuntu) Server at localhost Port 80

htaccess:

RewriteEngine On
RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule ^login/$ /login.php [L]

RewriteRule ^(.*)$ /zuo/index.php?acao=busca&q=$1 [L]

error log appears

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration e$tion error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer:

When I remove RewriteRule ^ login / $ /login.php [L] Right!

    
asked by anonymous 03.07.2015 / 19:36

1 answer

3

This is because you have not added a setting to check if the page is already index.php.

In this case ^(.*)$ means any page should be targeted

In the case I believe you tried to use RewriteCond %{ENV:REDIRECT_STATUS} ^$ to check if the page was already a redirect, but it did not work as expected.

Note: Do not use / in front of:

RewriteRule ^login/$ /login.php [L]
RewriteRule ^(.*)$ /zuo/index.php?acao=busca&q=$1 [L]

Use this:

RewriteRule ^login/$ login.php [L]
RewriteRule ^(.*)$ zuo/index.php?acao=busca&q=$1 [L]

Instead of using RewriteCond , you can try to use a RegEx like this with% of% to ignore if you start with ^(?!(index\.php)(/.*|)|login/.*|login.php)(.*)$ or index.php

The result:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^login/$ login.php [L]
RewriteRule ^(?!(zuo\/index\.php|login/.*|login.php))(.*)$ zuo/index.php?acao=busca&q=$2 [L]

I did not get to test, but the logic is.

    
03.07.2015 / 20:01