Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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/ ?

share|improve this question
    
Can you post the contents of /www/drupal5/.htaccess? Hopefully, it is possible to modify the rewrite rules so that requests for /server-status are not rewritten. –  Steven Monday Oct 23 '10 at 1:19
    
The clarification I think I need is: is it possible for mod_rewrite to overwrite what happens to a /server-status path even though it's been handled in the <Location> –  user58003 Oct 23 '10 at 1:29

3 Answers 3

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.

share|improve this answer

Just add a blank vhost entry to the top of the vhost configuration file e.g.

<VirtualHost *:80>
</VirtualHost>
share|improve this answer
1  
How would it solve the original question? –  Pothi Oct 9 '13 at 7:21
    
Apache is defaulting to the OPs first named vhost, their Drupal install, instead of going to the server-status page. An empty vhost will stop the processing for /server-status from being sent to Drupal and allow the status page to load –  xref Sep 11 at 17:09

If you're using Apache 2.3 or higher, you should also be able to use the END flag in your VirtualHost entry, to save having to modify the .htaccess files.

RewriteCond %{REQUEST_URI} /server-status
RewriteRule ^ - [END]

Should prevent the subsequent rules from rewriting things.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.