Wamp Server How To Create a Virtual Host Tutorial
I use Wamp to run PHP locally. The best way to set this up is to create a virtual host. In short, this points Wamp at your site where ever it happens to reside on your computer, vs having to move your site into the Wamp www folder. The following explains how to create a virtual host in Wamp.
Step 1: Open C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf and uncomment the virtual hosts include and save:
Step 2: Open your windows host file, C:\WINDOWS\system32\drivers\etc\hosts , and add the name you want to use for your virtual host.
Step 3: Open C:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf and add a “VirtualHost” block similar to below.
In text form for easy copy and paste...
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot "D:/Workspace/Zagweb/robert/public_html/" ServerName rob ErrorLog "logs/your_own-error.log" CustomLog "logs/your_own-access.log" common <directory "D:/Workspace/Zagweb/robert/public_html/"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from 127.0.0.1 </directory> </VirtualHost>
Step 4: Done! Restart WAMP and you should now be able to access your site via the virtual host. Access the virtual site via http://rob/.
Need help adding this or other code to your website? Post it here in the forum!