Forum Moderators: phranque

Message Too Old, No Replies

Redirect loop

         

floid78

11:10 am on Dec 9, 2013 (gmt 0)

10+ Year Member



I have this directive in my .htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?request=$1


This should rewrite all requests to index.php.

Sporadically, especially during peak times, I'm getting 500 internal server errors.

This is what I have found in the logs:

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


It's strange, because it's happening for requests which most of the time are working just fine.

Has anybody any explanation for this?

lucy24

5:00 pm on Dec 9, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you have one of these two before the quoted lines?

RewriteRule ^index\.php - [L]

OR, attached to your quoted rule as the first condition,

RewriteCond %{REQUEST_URI} ^/index\.php

Neither one is technically essential (because the file index.php does physically exist, or else you couldn't rewrite to it) but it may save your server some grief.

Is there any pattern to which requests the error applies to? Error logs will say. Are you using a "name" CMS or is it your own hand-rolled php?

g1smd

1:35 am on Dec 17, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteRule ^(.*)$ /index.php?request=$1 [L]

[edited by: phranque at 4:46 pm (utc) on Dec 17, 2013]
[edit reason] fixed typo [/edit]