Adding vhosts in Apache

On a native install on Mac, to add a vhost:

If you haven’t done this one time step, do this first to enable vhosts:

Then uncomment the line that includes the vhost config file:



Next add an entry to the hosts file

To add dev.localhost, do this:

Next, do this:

Then add a new entry for dev.localhost:
(This is for Apache 2.2)

(This is for Apache 2.4)

[Note the subtle differences between Apache 2.2, and 2.4. More info here ]


Also, be sure to remove the two dummy-host entries if they are there. Otherwise, you’ll get a warning about them not being found when you restart apache.