This has always bugged me and I've never got around to figuring out why Apache does this, I always resorted to the mod_vhost plugin to work around the issue.
Basically, I have 2 vhosts in sites-enabled (Ubuntu server), their contents:
<VirtualHost *> DocumentRoot "/var/www/vhosta.domain.com/" ServerName vhosta.domain.com <Directory "/var/www/vhosta.domain.com/"> allow from all Options +Indexes </Directory> </VirtualHost>
<VirtualHost *> DocumentRoot "/var/www/vhostb.domain.com/" ServerName vhostb.domain.com <Directory "/var/www/vhostb.domain.com/"> allow from all Options +Indexes </Directory> </VirtualHost>
Now logically these 2 would be accessible separately, however it seems that all requests to my server, no matter what vhosts I define on top of this, are going to vhosta.domain.com.
Am I missing something incredibly obvious? I really don't get why it's doing this..