Setting up virtual Host on Wamp Server is very easy. But first, we should look why it is beneficial to set up the virtual host.

While developing a site most of the developers works on the local server using WAMP/XAMPP server. In this case websites in development are stored in default root ie; c:\wamp\www in WAMP or in htdocs in XAMPP.

So if we are developing a site on the local server then the site can be accessed by localhost/ and the pages can be accessed by localhost/ or localhost/ etc.

But this can be eliminated by using virtual host server and we can access the site as if they are live. for example, if we are developing a WordPress site on the virtual host we need not change the URL in the database when moving the site from local to live server.

Let's start setting up the virtual host on windows.

Step 1:

open c:\wamp\bin\Apache\Apache.*.*.*\conf\httpd.conf (*.*.* is version of Apache)


Then find LoadModule vhost_alias_module and you will see something like this 

vhost_alias_module modules/

Uncomment this by removing #


Next, find Virtual Hosts , just in next line 
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf --> Uncomment this by removing #


Save and move to step 2 :

open c:\wamp\bin\Apache\Apache.*.*.*\conf\extra\httpd-vhosts.conf (*.*.* is the version of Apache)

setting up virtual host on wamp -step 2and add the below code at the bottom 

<VirtualHost *:80>
 DocumentRoot c:/wamp/www/
 <Directory "/">
   Deny from all
   Allow from

In above code snippets, replace the with your site directory name ie; 

Save and move to step 3 :

Open c:\Windows\System32\drivers\etc\hosts


and add

Done.! We have successfully set up the virtual host on wamp. Restart you wamp and access the site directly like or

Error Handling -

In case you get any error like Error 403 or wamp icon not turn green, run c:/wamp/bin/apache/apache2.4.9/bin/httpd.exe which will show the error if any.  Most common error is 403 forbidden. 

Steps to Fix 403 Forbidden Errors in Wamp Server -

open c:\wamp\bin\Apache\Apache.*.*.*\conf\httpd.conf and locate -

 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all


<Directory />
 AllowOverride none
 Require all denied

and replace with

 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 Allow from all

Restart the Wamp again.