Create and Setup Unlimited Virtual Host in your WAMP Server

Create and Setup Unlimited Virtual Host in your WAMP Server


Setup Unlimited Virtual Host in your WAMP Server

To set up a virtual host and a local domain, follow the steps mentioned below:

Step 1:  In folder C:/wamp/www on computer1, we now create 3 folders associated with domain and 2 subdomains as follows:

Step 2:  In each folder, we create folder logs to store the log files, and make sure to have these logs folders in place or your wamp will not run:


Step 3: open file httpd.conf in folder C:\wamp\bin\apache\apache2.2.6\conf and find these lines:

 # Virtual hosts
 #Include conf/extra/httpd-vhosts.conf

Step 4:  uncomment the second line, and make sure there is no blank space in front of second line and in the end of first line or your wamp will not run:

 # Virtual hosts
 Include conf/extra/httpd-vhosts.conf

Step 5:  open file httpd-vhosts.conf in folder C:\wamp\bin\apache\apache2.2.6\conf\extra, delete everything in there and replace with these codes below. Make sure to put your main site on very first and localhost in very last.

NameVirtualHost *:80
 <VirtualHost *:80>
 ServerName <a href="" target="_blank"></a>
 ServerAlias domain
 DocumentRoot C:/wamp/www/domain
 ErrorLog C:/wamp/www/domain/logs/error.log
 CustomLog C:/wamp/www/domain/logs/access.log common

 <VirtualHost *:80>
 ServerAlias sub1
 DocumentRoot C:/wamp/www/sub1
 ErrorLog C:/wamp/www/sub1/logs/error.log
 CustomLog C:/wamp/www/sub1/logs/access.log common

<VirtualHost *:80>
 ServerAlias sub2
 DocumentRoot C:/wamp/www/sub2
 ErrorLog C:/wamp/www/sub2/logs/error.log
 CustomLog C:/wamp/www/sub2/logs/access.log common

<VirtualHost *:80>
 ServerName localhost
 DocumentRoot C:/wamp/www
 ErrorLog C:/wamp/www/logs/error.log
 CustomLog C:/wamp/www/logs/access.log common

Step 6:  open file “hosts” in folder C:/Windows/System32/drivers/etc on computer1; then, delete and replace those dummy codes with these codes: localhost domain sub1 sub2

Step 7:  Now, you can access the domain on your local system as


2 comments to “Create and Setup Unlimited Virtual Host in your WAMP Server”
  1. Thank you Masud for this great tutorial, looking forward to read more of yours articles.
    Virtual hosts are up and running, if anyone ask.

Leave a Reply

Your email address will not be published. Required fields are marked *