Last Updated: February 25, 2016
· jaymabazza

Apache Multiple Virtual hosts setup

Updated August 2014

Say you want to create a local working copy of a website called "".

Open apache file called httpd-vhosts.conf. On Mac machine, it's normally found in:


add the following lines:

<VirtualHost *:80>
    DocumentRoot "/opt/local/apache2/htdocs/awesome-developer"
    DirectoryIndex index.php
    <Directory "/opt/local/apache2/htdocs/awesome-developer">
        AllowOverride All
        Allow from All

Now open your host file (normally /etc/hosts in Mac) and insert the following:

give your server and your browser a good cache clear, then you're good to go.

$> dscacheutil -flushcache

Now, create a file inside your new directory, then browse via

Updated August 2014