|
When hosting Joomla 1.5 on an Apache webserver activating search engine optimisation with 'mod_rewrite' causes the web server to start producing 500 script errors. On closer inspection of the webserver error logs shows we can see the following error: 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.
This error implies that the redirect has an uncontrolled loop in the scripting, probably as a result of an error in a condition or replacement. There appears to be a problem with the following section. ########## Begin - Joomla! core SEF Section # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/index.php RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] RewriteRule ^(.*) index.php RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] # ########## End - Joomla! core SEF Section The rule set is built up of two parts. Firstly we need to define conditions as to when this rule should be run, and secondly we indicate the rules we want to follow. I have highlighted the two rules where the problem exists. The first line "RewriteCond %{REQUEST_URI} !^/index.php" indicates don't perform this change if the URI is /index.php. This is designed to stop processing if we have already replaced the URI with /index.php. The seconf line "RewriteCond ^(.*) index.php" replaces anything on this line with the word index.php. The problem is that we are replacing the URL with index.php without a leading slash. This means that the rewrite condition designed to prevent looping doesn't match. The fix for this is very simple just add a leading slash in the RewriteRule then the RewriteCond now matches. The section now reads as follows: ########## Begin - Joomla! core SEF Section # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/index.php RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] RewriteRule ^(.*) /index.php RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] # ########## End - Joomla! core SEF Section |