500 error when using virtual host

The question:

I’ve got a WordPress MU install in a sub-directory of my webserver. When I point my virtual host at that directory I get my index page but no styling or access to any pages. It’s like it can’t access anything in the sub-directories of my WP root, I get the 500 error. When I check the Apache log it says,

“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.”

From the research I’ve done it points to an htaccess problem. However, when I delete the virtual host everything works fine. I’m not sure what else I need to try. I’m using Turnkey Linux. Any suggestions?

Here’s my config,

RewriteEngine On
RewriteBase /examples/
RewriteRule ^index.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]
RewriteRule . index.php [L]

I think I’ve narrowed it down to being something with the RewriteBase. Still no solution though.

UPDATE: Getting closer. I tried changing the last RewriteRule to,

RewriteRule ^(.+)$ /index.php/$1 [L,QSA]

Now I’m not getting the 500 error anymore but the CSS for my main site isn’t working and some image links. The second site works for the most part except a few broken links and such.

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

You should have a look at this: Request exceeded the limit of 10 internal redirects due to probable configuration error.? and RewriteRule Flags

It seems that you have a recursion in there. It is probably the last rule as the dot without anything else will match index.php as well.

Method 2

I tracked down this issue in my WordPress multisite install. The redirect limits were being triggered by default Word Press rewrite rules.

Original (faulty) rules

RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]

The problem occurred with requests to non-existant files in the wp-content, wp-admin, or wp-includes folders. Instead of triggering the normal 404 response, the first part of the rule matched the url whether it was a subsite link or not and thus looped infinitely.

Fixed rules

RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]

A look at the latest Word Press source code shows this to have been corrected. It only affects older multisite installs. The RewriteRules have to be manually updated.

Method 3

I can tell you that in wamp (havent seen your sever type) you need to do the following
in order to activate “mod_rewrite” so the system can work with permalinks..

1. click the icon of wamp on your bottom left (running programs)
2. Choose >> apache >> apache modules
3. here if you scroll trough the option you would find a mod_rewrite
4. activate it, restart your server and you should be ok

Hope this helps.
Cheers, Sagive

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment