Keep localhost hostname and still have virtual host for specific projects

By: Ryan Wong at

Today I had someone ask me how to setup a virtual host for their laravel project and still keep
their localhost for htdocs folder to do wordpress work.

The Solution we came up with was:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs/virtualhostproject
ServerName www.virtualhostproject.com

<Directory /Applications/MAMP/htdocs/virtualhostproject>
Options All
AllowOverride All
</Directory>

<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost

<Directory /Applications/MAMP/htdocs>
Options All
AllowOverride All
</Directory>
</VirtualHost>

I thought this was an interesting way to preserve your localhost.

Hope it helps you out.