Apache

Oct
2nd
09

Sub Domains in your Mac / Apache Development Enviroment

If you are like me and work on lots of different sites localy through the day, changing Apache’s path and restarting a can get a little tedious.

Follow these steps to set up subdomains for your local sites.

1. Open httpd.conf found in, for eg, /Applications/Mamp/conf/

Add these lines to the bottom of the file changing the path to your sub domains.

NameVirtualHost *

DocumentRoot /Users/WillBarker/Sites/smbu
ServerName smbu.localhost
 


DocumentRoot /Users/WillBarker/Sites/recess
ServerName recess.localhost

Open up /etc/hosts (its a system file so it is hidden by default in finder, i just open the file in Coda) and add these lines

127.0.0.1 recess.localhost
127.0.0.1 smbu.localhost

Save the file, restart apache, and wamo, you can work on your site at http://recess.localhost