Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rewrite-rules cases "Internal server error" (error.log inside)

I've upgraded and old eZ-Publish site to the newest PHP5-compatible 4.6-version (previously on PHP4). The site works on my local webserver, but when I try to up it to the server, it fails with the following message in Apache's error.log:

[Mon Apr 16 14:33:22 2012] [error] [client 46.249.225.2] Request exceeded the limit of 20 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

I've narrowed it down to a problem in the rewrite-rules, which is strange because I use the same rewrite-rules as other 4.6 installations. Here's the rewrite-rules in Apache's host file:

RewriteEngine On
Rewriterule ^/var/storage/.* - [L]
Rewriterule ^/var/[^/]+/storage/.* - [L]
#RewriteRule ^/var/cache/texttoimage/.* - [L]
#RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^/share/icons/.* - [L]
RewriteRule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?|lib|flash)/.* - [L]
Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon.ico - [L]
RewriteRule ^/robots.txt - [L]
RewriteRule ^/extension/sjsd/(FCKeditor|fcksjsd)/.* - [L]
RewriteRule ^/var/([^/]+/)?cache/public/.* - [L]
RewriteRule ^/extension/[^/]+/design/[^/]+/calendar/.* - [L]
RewriteRule ^/extension/[^/]+/design/[^/]+/calendar/ipopeng.htm - [L]
RewriteRule ^/extension/[^/]+/design/[^/]+/fckskins/.* - [L]
# Uncomment the following lines when using popup style debug.
# RewriteRule ^/var/cache/debug.html.* - [L]
# RewriteRule ^/var/[^/]+/cache/debug.html.* - [L]
RewriteRule .* /index.php

Does anyone spot any problems?

like image 586
Fredrik Avatar asked Feb 19 '26 22:02

Fredrik


1 Answers

Assuming that your .htaccess file is located in the root directory, your last rule creates an internal redirect which re-starts the rewriting process with /index.php as the URL that needs rewriting. The last rule rewrites /index.php as /index.php and the cycle continues. Try adding this line in your .htaccess file before the .* rule:

RewriteRule ^/index\.php$ - [L]
like image 139
Salman A Avatar answered Feb 21 '26 15:02

Salman A



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!