Domain Directing and Virtual Host Setup for WAMP Server


wamp_guy_leftearlAs with most developers who install WAMP you are probably working with localhost as your development domain name and directories for your projects.

For demonstration purposes lets say you are developing a WordPress or Joomla based site for Google where the domain is

So you would typically create this directory structure where all your project files would reside, assuming Wamp is installed in the C Drive.



Now you would be accessing this domain with the URL



And during your development life cycle all your links in the database and configuration will point to



This is not ideal when it comes time to migrate the site to the actual domain as now you will have to do some configuration and database maintenance to correct the links to point to the correct domain name.

So lets do it the right way.

Look in your Wamp installation directory and find the file named



Scroll right to the bottom and you will see a couple of lines that look like

#IncludeOptional "c:/wamp/vhosts/*"
Include "c:/wamp/alias/*"

Uncomment the top line so it looks like making adjustments to reflect your Wamp installation path.

IncludeOptional "c:/wamp/vhosts/*"
Include "c:/wamp/alias/*"

Now find your Windows hosts. file which is generally located in


You can try to directly open the file below in the text editor to save time trying to find it.


Once it is open the content will look something like this

# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
#          # source server
#              # x client host

# localhost name resolution is handled within DNS itself.
#       localhost
#	::1             localhost

Create a new line at the bottom with the line below without the hash(#) at the beging and save the file.

Now when ever you try to go to your browser will look for the domain on your computer or localhost automatically, so if you need to access the actual domain just add the hash(#) in front and save or delete the line and save.

Next go to the follow directory


and open the fileĀ httpd-vhosts.conf for editing

For the sake of simplicity add this Apache directive towards the bottom of the file and save it, you can add extended parameters to the VirtualHost directive if you wish.

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/google/"

That’s it now restart Apache and enjoy development on your project with less hassle at the end.



Please enter your comment!
Please enter your name here