Oh Apache

Man oh man.

I just resolved a stupid Apache issue that has been driving me nuts for over a year.

The problem was that one of the domains for this very blog,, wasn't working, while the other domain,, was working just fine. If you went to the later domain you saw the site, if you went to the former domain, you say Apache's default "It Works!" message. For some reason the default virtual host was being selected for even though it was listed as the ServerName of my blog's virtual host.

I tried making the ServerAlias and the ServerName. I tried adding NameVirtualHost *:80 to the beginning of all my vhost files, in case that was needed for some reason (this solved the issue I was having but caused other, weirder issues. Don't do this.) I even tried removing and re-writing the actual line ServerName incase there was some bad character hidden in there that was confusing things.

Finally I tried changing the server's hostname, because I thought maybe the default vhost was secretly adopting the server's hostname as its own and preventing my vhost from ever getting to handle it. What's stranger is that I was right. I changed my server's hostname from to and suddenly everything started to work.

So, the lesson is: Apache is woven of a subtle magic that maddens the minds of men. And: Apache's default vhost might take over your server's hostname and intercept any requests sent via it.

Addendum: Yes, nerds, I have a rewrite rule that makes forward to Please.