How to change the hosts file locally to preview website before domain transfer
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.
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".
Path to the hosts file
The hosts file is normally located here:
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
Go to "File". Click on "Open".
Find the folder as mentioned above.
- Choose to see "All Files" instead of .txt files since the hosts file is not a standard .txt file.
- Choose the "hosts" file and click "&Open".
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.
Go to "File" and choose "Save".
Open your web browser and go to the domain name you added to the hosts file.
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.
We have now been through how to easily make changes in the hosts file on your computer.