httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Warner" <li...@consulting.net.nz>
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 domain.co.nz will match any subdomain as
well! (like abc.domain.co.nz). 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:

  <VirtualHost domain.co.nz:80>
    ServerName domain.co.nz
    RewriteEngine On
    RewriteLog /var/log/apache2/rewrite.log
    RewriteLogLevel 0

    RewriteCond %{HTTP_HOST} ^abc.domain.co.nz
    RewriteRule ^/(.*) http://...

    RewriteCond %{HTTP_HOST} ^def.domain.co.nz
    RewriteRule ^/(.*) http://...

    RewriteCond %{HTTP_HOST} ^ghi.domain.co.nz
    RewriteRule ^/(.*) http://...

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

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?

Regards,
Adam



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message