Modifying your local hosts file (Windows)


In this tutorial you will be shown how to modify your local hosts file, this is a simple Windows tweak that is used to trick your computer into resolving to a specific IP. This is useful after a migration, as you are able to browse and test your website on our servers before changing over your nameservers/DNS.

Windows

Step 1: Open up Notepad to Run as Administrator

You will need to open up notepad as an administrator to be able to edit the hosts file.

Notepad is located in Start > Press Start on the keyboard >Â Type Notepad in the search field.






Right click on notepad, and select "Run as Administrator" - This will then open up notepad.



Â



Step 2: Locating the hosts file



Click on File > Open in notepad, and paste in this directory under "File Name" : %systemroot%\system32\drivers\etc\hosts and press enter or click "Open".





Â

Step 3: Editing the hosts file

The file will now open up for editing.






You can place the IP address and the domain name at the bottom of file. We will provide you with the IP address you will need to use.


The IP address will go first, followed by a space, followed by the domain name you are testing.

Once you have entered this in, and your file looks something like the image above, save the file.

Finally save the file. File > Save.






Your domain name will now point to that IP address. You might need to clear your cache- try closing and re-opening your web browser- before the changes take effect.

Once you have finished testing your website be sure to remove the line you added, and re-save the hosts file.



  Print


Comments


Please login to comment