Create Unique Domain Names Using Virtual Hosts

| |

If you´ve installed WordPress locally, you´ll usually access you´re projects via the localhost. For example http://localhost/wordpress or if you´re using WordPress MultiSite http://localhost/wordpress/project/.

This works fine, but it would be even better if we could use an specific domain name for each project. That way we could access our local WordPress installs via or any other name of your choice.

Luckily that´s quite easy to set up by creating Virtual Hosts in Apache.

To set up Virtual Hosts and start using your own unique domain names, follow this detailed tutorial: How to Set Up Virtual Hosts Using WAMP.

How to edit the host file in Windows 7

To use Virtual Hosts, you´ll need to edit the Windows host file. On Windows 7, editing the host file requieres a few extra steps.

  1. Open the folder Start > All Programs > Accessories
  2. Right click on the Notepad entry and select Run as administrator
  3. In Notepad, choose File > Open and select All Files (*.*) from the dropdown menu in the dialog box
  4. Browse to the directory C:WindowsSystem32driversetc and open the hosts file
  5. Edit and save the file

That´s not all. You´ll see that Windows 7 saved the file as a text file (.txt), even if we choose to save it without the text extension. Let´s change that.

  1. Make sure you´re still in the C:WindowsSystem32driversetc directory
  2. Press the alt key
  3. In the top menu, select Tools > Folder Options > View and untick the box Hide extensions for known filetypes
  4. Rename the hosts.txt file to hosts without the extension

Tips, tricks and troubleshooting

  • Remember to update the WordPress Address and Site Address in the Settings panel, if you already installed a WordPress site locally
  • If you get this error message: “You don’t have permission to access / on this server” – this solution might work

Install WordPress locally using WampServer (WAMP) – Part 2

Install WordPress Quickly Using SSH