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
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
http://wordpress.dev 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.
- Open the folder
Start > All Programs > Accessories
- Right click on the Notepad entry and select
Run as administrator
- In Notepad, choose
File > Openand select
All Files (*.*)from the dropdown menu in the dialog box
- Browse to the directory
C:WindowsSystem32driversetcand open the
- 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.
- Make sure you´re still in the
- Press the
- In the top menu, select
Tools > Folder Options > Viewand untick the box
Hide extensions for known filetypes
- Rename the
hostswithout 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