I have a site at:
sub.site.com
I want to other domains to point to it. On the old server, everything was setup through cpanel. On the new server, I have the vhosts file as:
<VirtualHost sub.site.com:80>
ServerAdmin
webmaster@dummy-host.example.com
DocumentRoot /home/sites/site
ServerName sub.site.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost domain.com:80>
ServerAdmin
webmaster@dummy-host.example.com
DocumentRoot /home/sites/site
ServerName domain.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost domain.net:80>
ServerAdmin
webmaster@dummy-host.example.com
DocumentRoot /home/sites/site
ServerName domain.net
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
It seems like this should work, because all three are pulling from /home/sites/site
But it doesn't work. It also gives a message when I restart apache:
VirtualHost domain.com:80 overlaps with VirtualHost domain.net:80, the first has precedence, perhaps you need a NameVirtualHost directive