How to edit your Windows HOSTS file

Here are some instructions to follow to in order to edit your Hosts file on your windows pc so that you can see the a new hosting location by the domain name vs an ip address during development. This can often be helpful or completely necessary if the site is "foring" redrection to a domain name or "www" domain name.

Steps to edit your host file

  1. close all internet-related applications like Internet Explorer, FireFox, Chrome, and for good measure, also close Outlook and Instant Messenger applications
  2. Open windows file explorer (keyboard shortcut: Windows Key + e)
  3. paste the following into the “address” location in the top of the window
  4. C:\WINDOWS\system32\drivers\etc 
  5. and hit the enter key
  6. this takes you to the folder that contains a file called simply “hosts” with no file extension.
  7. right-click on the “hosts” file and choose “create shortcut”
  8. drag the newly created “Shortcut to hosts” file to your desktop
  9. close the “etc” folder window, we will not need it now
  10. You may now double-click on the “shortcut to hosts” file, this will open a dialogue window that asks “what application to open the file with”. Please scroll down through the list and choose “Notepad” and click “OK”
  11. this will open the file in notepad. add to the bottom of the list on the page the following line
  12. 12.34.567.890 www.domainname.com
  13. save the file and close Notepad.

Now, when you go to the www.domainname.com location in Internet Explorer, you will be taken to the NEW hosting location and you can login and work in this location just as normal.

Once you are done, or if you need to see the old/original location again, open the hosts file again and “comment out” that line by adding a # infront of the line as in: # 12.34.567.890 www.domainname.com

In this manner, you can comment out/in the line as needed to quickly access one site or the other.