How to use DocumentRoot and server-status within an Apache virtual host

apache-2.2virtualhost

I have this virtual host setup as the first in a list of virtual hosts. It is

<VirtualHost localhost:80>
ServerName localhost
DocumentRoot "/www/drupal5"

<Location /server-status>
    SetHandler server-status
    Order Deny,Allow
    Allow from localhost
</Location>
</VirtualHost>

The rest of the virtual hosts are below and expressed as *:80.

When I include the DocumentRoot in this virtual host, requests on the server to http://localhost/server-status always hit /index.php through rewrite rules in /www/drupal5/.htaccess. If I remove the DocumentRoot declaration, /server-status requests work fine, but then the site isn't available at all at http://localhost/.

How can I get http://localhost/server-status to work as well as the site to load at http://localhost/ ?

Best Answer

Found the solution when I googled 'server-status mod_rewrite'. Coincidentally it was answered in a drupal forum: http://drupal.org/node/52511

Adding RewriteCond %{REQUEST_URI} !=/server-status to the rewrite rule for redirecting all traffic to /index.php fixed it.

Very confusing that mod_rewrite can rewrite a uri that's already set a handler.