httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Warner" <>
Subject [users@httpd] Is this a VirtualHost bug? (domain matches subdomains)
Date Thu, 12 Sep 2002 09:29:11 GMT
Hi all,

I've come across this behaviour and I thought I should check whether it is
a bug.

With Apache 2.0.40 (from Debian Unstable) VirtualHost configuration, a
ServerName of the form will match any subdomain as
well! (like And it will match this entry even if I
place the non-subdomain entry at the end of the configuration file.

I've worked around this by putting everything into one VirtualHost
directive. Here's a generic example:

    RewriteEngine On
    RewriteLog /var/log/apache2/rewrite.log
    RewriteLogLevel 0

    RewriteCond %{HTTP_HOST} ^
    RewriteRule ^/(.*) http://...

    RewriteCond %{HTTP_HOST} ^
    RewriteRule ^/(.*) http://...

    RewriteCond %{HTTP_HOST} ^
    RewriteRule ^/(.*) http://...

    #The domain without a subdomain or any other subdomain will match this...
    RewriteRule ^/(.*) http://...

This doesn't appear satisfactory as the ServerName is only correct
for the last site (the one without a subdomain).

Should a ServerName without any subdomain match all subdomains as is
happening to me?


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message