How to edit your hosts file (Windows, Mac OS X, GNU/Linux)

victor

Here at Ready Artwork there are times when we need you to edit your hosts file in order to view your website in development. What is the hosts file? That is a topic I’ll save for a Wednesday’s Web Word. But just think of it as a phone book for unlisted websites, and your computer needs to be programmed to show your unlisted website. Just remember to undo any changes after you are done viewing the website.

Windows

  1. The location of the hosts file is different for different versions of Windows. Please Find out which version you are running. If you recently bought your windows computer in this decade you should be running Windows 7 or later. Windows XP/Vista/7 C:Windowssystem32driversetchosts Windows NT/2000/XP Pro C:winntsystem32driversetchosts Windows 95/98/Me C:Windowshosts
  2. Now that you know the location of the hosts file, Open up Notepad as administrator, by going through the start menu and locating “Notepad” and right clicking on it and click “Run as Administrator“.
  3. Next Click on File open and paste in the above location for the hosts file and open the hosts file using Notepad.
  4. You should see something like “127.0.0.1 localhost”
  5. On a new line type in the IP Address and the domain address of your site. Ex 74.125.224.52 www.google.com
  6. Save your file and then clear your browsers cache and restart your computer.
  7. After restarting, open up your internet browser and type in your domain, you should now be at the new site! If you can’t see your site, disable your antivirus and restart and you should be able to see it.

Mac OS X

  1. Open a terminal via going to the spotlight and typing in “terminal“
  2. In terminal, type “sudo open /etc/hosts”, enter your password and TextEdit should open your hosts file.
  3. You should see something like ”127.0.0.1 localhost”
  4. On a new line type in the IP Address and the domain address of your site. Ex 74.125.224.52 www.google.com
  5. Save your file and then clear your browsers cache
  6. Open up your internet browser and type in your domain, you should now be at the new site!

GNU/Linux sudo emacs /etc/hosts in most distributions…

Meet the Author
victor
Sales
meet the author
Related Articles