9

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

2
  • 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. Commented Oct 23, 2010 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> Commented Oct 23, 2010 at 1:29

3 Answers 3

15

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.

0
5

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

<VirtualHost *:80> </VirtualHost> 
3
  • 2
    How would it solve the original question? Commented Oct 9, 2013 at 7:21
  • 1
    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 Commented Sep 11, 2014 at 17:09
  • But won't this new "first" VirtualHost catch all traffic and thus prevent all normal (non-server-status) traffic from flowing through to the Drupal application VirtualHost? Commented Sep 15, 2021 at 19:15
3

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.

You must log in to answer this question.