Adding a Virtual Host (vhost) in XAMPP on a Mac

Recently, I had to set my other mac up with a local dev environment and found it hard to find the correct files to edit on a mac with XAMPP. I want to set up an environment where I can hit and get served XAMPP files. So here goes:

Edit your hosts on mac 10.6:

In /etc/hosts – add the following line to the end of the file:

Edit your XAMPP vhosts file:

In /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf add the following to the end of the file:

<VirtualHost *:80>
        DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"

Finally, edit your XAMPP apache config file:

In /Applications/XAMPP/xamppfiles/etc/httpd.conf uncomment the following line:

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

Now stop apache, restart XAMPP and you should be able to visit:


Leave a Reply

Your email address will not be published. Required fields are marked *