How to Modify Your Hosts File so You Can Work on a Site That Is Not Yet Live

How to Modify Your Hosts File so You Can Work on a Site That Is Not Yet Live
The usual progression for building a website is
  1. Choose a domain name for your website.
  2. Purchase the rights to use that domain name from a registrar.
  3. Choose a hosting company to host your website.
  4. Build your website.
  5. Contact your registrar to direct the DNS servers to point web requests for content on your site to the server that's hosting it.
Many hosting companies supply a temporary alias that is added to your domain name so you can work on your site before making it live to the rest of the world. If you don't have a temporary alias or don't want to use it, but do need to access your website before contacting your registrar, you can modify the hosts file of your local machine.

The hosts file is a file that all browsers look at when getting a new website request prior to going to their DNS server. When you enter a website in your browser, your PC first looks at the hosts file for information and if it doesn't find the website there, it asks the ISP's DNS server to locate the IP address of the site.
Modify the Hosts File on a Windows 8 PC
Windows 8 protects the hosts file from modification by malicious programs. To modify it, you must run Notepad as an administrator.
  1. Press the Windows key on your keyboard, type Notepad, but do NOT press Enter.
  2. Right click on Notepad and choose Run as Administrator.

  3. Log in (or have a someone with admin credentials log in).
  4. Click File > Open.
  5. Navigate to C:\Windows\System32\drivers\etc.
  6. In the lower right corner of the Open dialog box, change the Text Documents (*.txt)  to All Files.

  7. Double click on hosts.
Modify the Hosts File on a Windows 7 or XP Machine
  1. Click on Start > Run > c:\.
  2. Navigate to c:\Windows\System32\drivers\etc and double click on hosts.
  3. Open it with Notepad.

    Hosts File
  4. Add the IP address of the server that is hosting your website.
  5. Press Tab and add the domain name of your website.
  6. Save the hosts file.
    • If you are unable to save it due to security policies on your computer, save it with a different name, like hosts2. Close Notepad. Delete the original hosts file and rename hosts2 to hosts.
  7. You should be able to access your website (without a temporary alias) from your local machine by entering the domain name in the address bar of your browser.
  8. Repeat the above process on any other machines you will be using when creating content for the site prior to making it live.
Modify the Hosts File on a Mac or Linux
  1. Open the Terminal app.
  2. Type sudo nano /private/etc/hosts. for Mac, sudo nano /etc/hosts for Linux.
  3. Enter the IP address and domain name on a new line at the end of the file, as shown above.
  4. Save.
For additional instructions on how to add hosts to the local hosts file in Mac OS X see

Add Feedback