';

How to change the hosts file locally to preview website before domain transfer


EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 07.12.2016 11:04:45     Last updated: 08.02.2017 12:38:55

In this guide we look at how to make changes in the hosts file on your computer. With this method you can verify that your website is working as it should on our web hosting servers before approving the transfer of your domain name or before a domain name is registered. The pictures in the guide shows how to do this in Windows 10.

What is hosts file changes
The hosts file is mostly used to trick the machine to open requests to a specific IP address for specific host names. This is usually used by developers when they develop websites on a different server than where it's currently located online.
If you have a WordPress/Joomla website under construction and you want to develop a new website while the old one is still in use without changing DNS or transferring the domain name.

Step 1:
Edits in the hosts file must be done with administrator access. This is because the hosts file is a system file, and cannot be changed without.
Search for the Notepad program on your machine and right click to choose "Run as administrator". You will be asked to allow that this app makes changes on the device. Choose "Yes".

Run Notepad as administrator in Windows 10


Path to the hosts file
The hosts file is normally located here:
c:/windows/system32/drivers/etc/hosts

If you cannot find the file there, you can try alternate paths:
Windows 95/98/Me - c:/windows/hosts
Windows NT/2000/XP Pro - c:/winnt/system32/drivers/etc/hosts
Windows XP Home/Vista/Windows 7 - c:/windows/system32/drivers/etc/hosts
Windows 8 - c:/windows/system32/drivers/etc/hosts
Windows 10 - c:/windows/system32/drivers/etc/hosts
Mac OS X - Leopard - /private/etc/hosts

Step 2:
Go to "File". Click on "Open".

Open hosts file in Notepad


Step 3:
Find the folder as mentioned above.

  1. Choose to see "All Files" instead of .txt files since the hosts file is not a standard .txt file.
  2. Choose the "hosts" file and click "&Open".
Open the hosts file in Notepad


Step 4:
In this example we have ordered hostproisp.no, but the domain is not registered.
The IP address that is received after ordering or via our customer pages is then added to the file with and without www.
It is also recommended to take a backup/copy of the file before you make changes to it.

Edit the hosts file


Step 5:
Go to "File" and choose "Save".

Save changes in the hosts file


Step 6:
Open your web browser and go to the domain name you added to the hosts file.

Visit the domain name you added to the hosts file


NB!
When you go to the domain name you added to the hosts file, the machine will send you to the IP you have specified in the hosts file. If the domain name is in use on a different server and you want access to it again you must remove the lines you added in the hosts file.

Done
We have now been through how to easily make changes in the hosts file on your computer.