Virtual Hosts in Windows under WAMP
Using nice domains instead of localhost
Do you want to call your localhost websites from a webbrowser using nice URLs like: mysite.dev or somethingelse.dev? Here's a way how to do this under Windows.First edit your Apache's httpd.conf file. Look for "DocumentRoot" and then change into something like this ("e:/wamp/www" is the path to my sites):
DocumentRoot "e:/wamp/www/"
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "e:/wamp/www"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName mysite.dev
DocumentRoot "e:/wamp/www/mysite-dev"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName somethingelse.dev
DocumentRoot "e:/wamp/www/somethingelse"
</VirtualHost>
Then edit file C:\WINDOWS\system32\drivers\etc\hosts and add these:
127.0.0.1 somethingelse.dev
127.0.0.1 mysite.dev
That's it!
Comments