httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark McCulligh <mmccu...@visualtech.ca>
Subject Re: [users@httpd] NameVirtualHost Defaults
Date Thu, 30 Sep 2004 21:00:59 GMT

tom@plik.net wrote:

>Hi -
>
>I currently have a setup like this:
>
>----
>NameVirtualHost *:80
>
><VirtualHost *:80>
>ServerName a.site.com
>[... snip ...]
></VirtualHost>
>
><VirtualHost *:80>
>ServerName b.site.com
>[... snip ...]
></VirtualHost>
>
><VirtualHost _default_:80>
>ServerName c.site.com
>[... snip ...]
></VirtualHost>
>----
>
>The hosts a.site.com, b.site.com, c.site.com, and d.site.com
>(d.site.com doesn't have a VirtualHost entry) all have the same
>IP. If I enter http://d.site.com/ in my browser,
>http://c.site.com/ doesn't load. http://a.site.com/ loads
>instead, I'm assuming because it comes first in alphabetical
>order.
>
>How can I make it so that if I enter in http://d.site.com/,
>http://c.site.com/ will load as the default page?
>
>Thanks for any help.
>
>  
>
You are right in your assumption. If you have vhost using the same IP 
address and someone ask for a domain name that is not found to have its 
own vhost record it will load the first vhsot record with that IP address.

I would use |ServerAlias:
|

<VirtualHost *:80>
ServerName c.site.com
ServerAlias d.site.com
[... snip ...]
</VirtualHost>

I wouldn't do the _default_ method personally.  Using ServerAlias will 
keep you vhost record easy to read and know what will link to what. Just 
my two cents.

Mark.


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