Sub Domains in your Mac / Apache Development Enviroment
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.
Show Plain Text- NameVirtualHost *
- <virtualhost>
- DocumentRoot /Users/WillBarker/Sites/smbu </virtualhost>
- <virtualhost>
- ServerName smbu.localhost
- </virtualhost>
- <virtualhost>
- DocumentRoot /Users/WillBarker/Sites/recess
- </virtualhost>
- <virtualhost>
- ServerName recess.localhost
- </virtualhost>
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 view source print
Show Plain Text- 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
