Log in now:

Quick log in:

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/local.mangopear.co.uk/ (assuming my build was located at C:/wamp/www/local.mangopear.co.uk/) I visit http://local.mangopear.co.uk.

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/www.mangopear.co.uk/.

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/www.sitename.com/or C:/wamp/www/sitename/

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

Let’s imagine we want to access it at http://local.sitename.com/ we would follow the steps below.

It’s worth noting that you do not want to set your alias to http://sitename.com/ 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:

Open your favoured text editor (could be Notepad or Sublime Text);

Open the httpd.conf file located at C:/wamp/bin/apache/apache2.4.9/conf/extra/;

Search for “Virtual hosts” and remove the # from the line below which should read: “Include conf/extra/httpd-vhosts.conf“; and

Save the config file.

2. Register your alias:

In your text editor, now open the Virtual hosts configuration file:C:/wamp/bin/apache/apache2.4.9/conf/extra/http-vhosts.conf