How do I modify my hosts file?

Modify your local computer’s hosts file to override the DNS for a domain. Do this to test your site before you launch to make sure your website is ready for launch. This causes your local computer to go directly at the IP specified instead of the IP in public DNS. You can see what the rest of the world can’t see.

Add entries to your hosts file with the IP address you want the site to resolve to. Adding the below lines will point and to our current Nginx load balanced cluster of servers, for example.

Locate and Edit your Hosts File

Once you make the change, you can either flush your hosts file to view the change or, if you’re a developer who launches new websites often, we recommend turning off you DNS Service in your computer’s Services menu. Save the file and your system will begin resolving to the new IP.

Choose your operating system

Windows Vista and Windows 7

Vista and Windows 7 uses User Account Control (UAC) so Notepad must be run as Administrator.

  1. Click Start -> All Programs -> Accessories
  2. Right click Notepad and select Run as administrator
  3. Click Continue on the “Windows needs your permission” UAC window.
  4. In Notepad, click File -> Open
  5. In the filename field type C:\Windows\System32\Drivers\etc\hosts
  6. Click Open

Windows NT/2000/XP/2003

  1. Click Start -> All Programs -> Accessories -> Notepad
  2. Click File -> Open
  3. In the filename field type C:\Windows\System32\Drivers\etc\hosts
  4. Click Open

Mac OS X 10.6 +

  1. Open Applications > Utilities > Terminal.
  2. Open the hosts file by typing the following in the Terminal window:
    sudo nano /private/etc/hosts
  3. Enter your user account password if prompted. This is the same password you use to login to your computer. It must have Administrator privileges.
  4. Edit your hosts file. The hosts file contains comments (you’ll see lines starting with the # symbol), as well as some default hostname mappings (e.g. – local host). Add your new mappings underneath the default ones. localhost
        #this is a comment
        #add your own mappings here
  5. Save the hosts file. On your keyboard, press Control+o to save the file and Control+x to exit and go back to the Terminal command prompt.
  6. Flush your DNS cache
    dscacheutil -flushcache