After writing my last article about using apache's RewriteCond to work with multiple codebases on localhost, a coworker pointed out a far simpler method using apache VirtualHosts.
On my dev machine, I'm lazy about server admin and just use wamp. To work with multiple codebases below is my simple and easy configuration.
In httpd.conf:
<VirtualHost *:80> DocumentRoot "c:/wamp/www" ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "c:/wamp/www/app1/" ServerName app1 </VirtualHost> <VirtualHost *:80> DocumentRoot "c:/wamp/www/app2" ServerName app2 </VirtualHost>
In hosts file (c:/WINDOWS/system32/drivers/etc/hosts):
127.0.0.1 localhost 127.0.0.1 app1 127.0.0.1 app2
Access in the browser:
http://app1/ http://app2/
It can't get much easier.
