Skip to content

Working locally with WAMP: Setting up aliases.

Working locally with WAMP: Setting up aliases.

I find it easier to work with my locally hosted websites when they run off of an alias. Instead of visiting http://localhost/ (assuming my build was located at C:/wamp/www/ I visit

It’s worth noting that my folder structure for builds is based on their would-be live domain names – for instance the build for this website is stored in C:/wamp/www/

For working locally I use WAMP (Windows; Apache; MySQL; PHP) as it’s simple to set up and works across my Windows devices. At this point I’d like to mention Finch – which is a great app for testing your local development projects from other devices.

Setting up Aliases

Your folder structure:

The instructions below are based upon the assumption that your folder structure is similar to mine i.e. (if your project is called SiteName) C:/wamp/www/ or C:/wamp/www/sitename/

Normally, with the above, you would visit either: http://localhost/ or http://localhost/sitename/

Let’s imagine we want to access it at we would follow the steps below.

It’s worth noting that you do not want to set your alias to as this would prevent you from being able to access the live domain from your development device as the alias would override the default DNS for that domain name. You should always use a domain name that will not be in use – such as local.(…).

1. Enable VirtualHosts in Apache:

By default WAMP does not enable VirtualHosts. Thankfully it’s very easy to enable them:

  1. Open your favoured text editor (could be Notepad or Sublime Text);
  2. Open the httpd.conf file located at C:/wamp/bin/apache/apache2.4.9/conf/extra/;
  3. Search for “Virtual hosts” and remove the # from the line below which should read:
    Include conf/extra/httpd-vhosts.conf“; and
  4. Save the config file.

2. Register your alias:

  1. In your text editor, now open the Virtual hosts configuration file:
  2. At the bottom of this file, add a new VirtualHost. See the Gist below for an example of this.
  3. You will need to change the ServerName; DocumentRoot; and Directory values to match your development instance.
<VirtualHost *:80>
	# The name to respond to
	# Folder where the files live
	DocumentRoot "c:/wamp/www/"
	# A few helpful settings...
	<Directory "c:/wamp/www/">
		allow from all
		order allow,deny
		# Enables .htaccess files for this site
		AllowOverride All
	# Apache will look for these two files, in this order, if no file is specified in the URL
	DirectoryIndex index.html index.php

3. Edit your hosts file

  1. Open Notepad in Administrator mode (go to start menu; search for “Notepad”; right click; and select “Run as Administrator”)
  2. Open your hosts file, which is located at:
  3. Add a new entry at the bottom of this document:

4. Restart your WampServer

  1. Locate the Wampserver icon in your taskbar;
  2. Click to reveal menu;
  3. “Restart all services”;
  4. Wait for the icon to turn green and you’re ready to go.

No comments

Add a comment

Start the conversation.
Be the first to comment.

Popular topics

On development

On best practice

On content strategy