Error 500 Request exceeded the limit of 10 Internal Redirects

Asked

Viewed 1,464 times

2

I’m having 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]

in the 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 removed Rewriterule login/$ /login.php [L] of the right!

  • Good evening, I wonder if any of the answers helped you, if not please comment on what you think is missing.

1 answer

3

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

In case this ^(.*)$ means any page must be directed

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

Note: Don’t use the / in front of:

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

Use like this:

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

Instead of using the RewriteCond you can try using a Regex like this ^(?!(index\.php)(/.*|)|login/.*|login.php)(.*)$ which you will ignore if you start with index.php or index.php/path

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 didn’t get to test it, but the logic is.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.