HELP! I just setup a virtual host for two sites that have a lot of traffic and I think I just messed something up! Here is the end of my httpd.conf:
NameVirtualHost * <VirtualHost *> ServerName www.mydomain.com DocumentRoot /var/www/html </VirtualHost> <VirtualHost *> ServerName www.mydomain2.com DocumentRoot /var/www/downloadr </VirtualHost> <VirtualHost *> ServerName mydomain2.com DocumentRoot /var/www/downloadr </VirtualHost>
I added the last virtual host to solve the problem of mydomain2.com going to wwww.mydomain.com. HOWEVER, what has happened now is that http://www.mydomain2.com goes to http://www.mydomain.com.
Please help!!!
Thanks all
UPDATE
STUPIDITY beyond words – managed to copy one site to two directories and hence the 2 domains pointing to the same place!! OMG this will not happen again. Double check and recheck and recheck and recheck and recheck and recheck……..
Btw, why would someone neg rep me for this?
Instead of adding the third virtual host, add
to the second one. So your entire configuration would be basically this:
If you want requests for
mydomain.comto actually be redirected towww.mydomain.com, so that the user sees the URL change in his/her browser, that can be done withmod_rewrite(but that’s the subject of another question, search for it if you like)