Forums/Frequently Asked Questions

How do I edit my "hosts" file?

Chris Kacerguis
posted this on December 04, 2011 08:08 am

Windows

  • Right click the Notepad application and select "Run as Administrator" to edit this system file. If you do not have admin privildges, you will not be able to edit your hosts file.
  • Open the hosts file at C:\Windows\System32\drivers\etc\hosts
  • There should already be an entry for "localhost". Follow that format when you insert your domain and our IP. For example:
127.0.0.1 localhost
204.11.246.1 www.example.com
  • Then save this altered hosts file and close notepad. Make sure Windows did not silently save the file as "hosts.sam". The filename has to be "hosts".
  • Once you have modified your hosts file, you can flush your DNS so that you can see your new changes more quickly You can either
    • reboot
    • open a command prompt and use the command
ipconfig /flushdns

Next time you try to go to "www.example.com", your browser will try to find your domain at the corresponding IP instead of looking up the IP through DNS.

Mac

  • Open Finder.
  • In the Go menu, select "Go to Folder"
  • Type /etc for the folder name.
  • In the list of files that appears, you should find "hosts. Double click it to open it in a text editor.
  • As in the windows example, the format of the file is: "204.11.246.1 www.example.com".
  • You will need to clear your dns cache or wait for these changes to go into effect. You can clear your cache by rebooting or running the following command from Terminal:
lookupd -flushcache
 
Topic is closed for comments