Reputation: 50
This is my .htaccess file :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
I'm getting 500 internal server error . After this command: cat /var/log/apache2/error.log I got this errors :
AH00124: 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.
Please help me sort out this ?
Upvotes: 1
Views: 7033
Reputation: 14523
Change your htaccess rule to below and then it will work.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1 [L,QSA]
Upvotes: 3
Reputation: 2191
Checkout this serverfault answer.
In summary, [L] only stops the processing for the current ruleset, and passes the rewritten URL back to the URL parsing engine, who might apply your ruleset again. 10 times. And then Apache says stop.
You could add a condition to not rewrite if the rewrite is already going to index.php
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule . index.php [L]
Or, you could check ENV:REDIRECT_STATUS
before your other rules and stop any further rules from being applied:
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Upvotes: 1