My 404s Don't code and drive

About

Footnote on VirtualHost in Apache2

I recently had to reinstall my web server. I got a really big problem when the virtualhost started overriding the default documentroot. So localhost would point to mysite.locahost etc. A really annoying problem. It turns out that you need to add the original server name first before defining any virutalhost domains. Or as it said on the Apache webpage under “Main host goes away”(someone should really work on that semantic)

"If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host."

So basically this is what you need to have in your virutalhost conf file

<VirtualHost *:80> DocumentRoot “/Users/myuser/www/” ServerName localhost </VirtualHost>

<VirtualHost *:80> DocumentRoot “/Users/myuser/www/mysite/” ServerName mysite.localhost </VirtualHost>