Setting up a hostname alias for your site

If you are developing on a workstation and referring to your website as localhost then please follow these steps to create a hostname alias for your site. This allows you to refer to your site with a name like

Hostname aliases also have the benefit of making it possible to develop any number of websites on your local machine, instead of just the one, since you can refer to each by its own name.

On Linux and Mac OS X, edit the file /etc/hosts. On Windows, edit the file C:\WINDOWS\system32\drivers\etc\hosts. Add the following line:

You can now save and close the file. To add more sites, simply add new entries to this file, for example:

From here, you can create virtualhosts in your Apache or Nginx configuration that point to each of your virtual hostnames. For example:


    DocumentRoot "C:/wamp/www/mywebsite"

Remember to restart your web server in order to see changes you've made to it. You should now be able to access your website at instead of http://localhost.

Next: Installation

Edit this page.
This documentation was generated by the Elefant Documentation Project. We're always open to new contributions *wink* *wink*