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
- close all internet-related applications like Internet Explorer, FireFox, Chrome, and for good measure, also close Outlook and Instant Messenger applications
- Open windows file explorer (keyboard shortcut: Windows Key + e)
- paste the following into the “address” location in the top of the window
- and hit the enter key
- this takes you to the folder that contains a file called simply “hosts” with no file extension.
- right-click on the “hosts” file and choose “create shortcut”
- drag the newly created “Shortcut to hosts” file to your desktop
- close the “etc” folder window, we will not need it now
- 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”
- this will open the file in notepad. add to the bottom of the list on the page the following line
- 12.34.567.890 www.domainname.com
- 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.