Development Web

VirtualDocumentRoot for local development

If you want to develop locally on your machine, its a pain to have to write a virtualhost container and restart apache every time. There is a simple way to do this by using VirtualDocumentRoot directive.

1) use localhost as the domain and create subdomains in /etc/hosts ie devsite.localhost

2) Put this into your httpd-vhosts.conf file

VirtualDocumentRoot /my_home_dir/Sites/%0

AllowOverride All

Order allow,deny
Allow from all
All your development sites need to be in /my_home_dir/Sites and the directories must have the same name as the entry in /etc/hosts ( ie /my_home_dir/Sites/devsite.localhost/ )