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.

The only virtual hosts i have are:

<VirtualHost *:80>
DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    # etc...


<VirtualHost xx.xx.xx.xx:80>

DocumentRoot /var/www/vhosts/beta.foo.com/htdocs
ServerName beta.foo.com

<Directory /var/www/vhosts/www.foo.com/htdocs/>
    Options All -MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all

ErrorLog  /var/www/vhosts/www.foo.com/logs/error.log
LogLevel debug  
CustomLog /var/www/vhosts/www.foo.com/logs/access.log combined


beta.foo.com is perfectly reachable, and that's the expected behaviour.

But when i try to get www.foo.com, it resolves to beta.foo.com and not to the default configuration.

Is this an Apache rule?

Is there a way to avoid this?

The only way is to set a virtual host with ServerName www.foo.com?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The documentation explains how the virtual host is chosen. Basically, your beta.foo.com host is chosen because it has a specific IP address, whereas the default host uses a wildcard. Either change your beta.foo.com block to also use a wildcard, or change your default host to use the specific IP.

share|improve this answer
thanks, really! –  apelliciari Mar 18 '13 at 21:44

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.