Apache VirtualHost


Just writing this up for a friend:

1) Add the “hook” in C:\WINDOWS\system32\drivers\etc\hosts   “127.0.0.1 http://www.your-hook.com

2) Define the desired host in Apache’s config located in C:\xampp\apache\conf\extra\httpd-vhosts.conf like so:

NameVirtualHost *:80 #localhost
<VirtualHost *:80> 
 DocumentRoot "C:/xampp/htdocs" 
 ServerName localhost:80 
</VirtualHost> 
<VirtualHost *:80> 
 DocumentRoot "C:/xampp/htdocs/your-hooked-site" 
 ServerName www.your-hook.com
</VirtualHost>

3) Restart Apache and type “http://www.your-hook.com” on your browser’s address bar. That’s it.

Advertisements