Select Page

Apache named-based virtual hosts

Trying to set up some subdomains on, I had some problems configuring my Apache to deal with the different incoming domains.

The problem was my NameVirtualHost wasn’t defined, and all subdomains were directed to the default directory. Finding documentation on this was a little tricky as NameVirtualHost wasn’t even in my httpd.conf file. However once I defined this, they all worked perfectly.

NameVirtualHost *

Also I found that having the path to the directory in quotes or not in quotes didn’t matter. Another thing I discovered is that if there is no name match, it will default to the first reference, so putting this somewhere unique (or to your root) might help you debug if there are problems.