Starting a new website requires time. For domain registration, for setting up Hosting account and the most important, the time of 24-48 hours during which DNS propagates is a lot. Also if you are going to change your web hosting then again your website will go down for almost 24-48 hours due to DNS propagation. It means that neither you nor your visitors will be able to view website during DNS Propagation.

It’s a fact that DNS switching takes time and website also goes down during that time. But you can still access your website before DNS propagation is completed with a cool trick.

Recently I had to setup a blog for one of client and I bought the domain name from Godaddy and I had to link it with Hostgator Servers. In order to save my time, I used this trick and instantly I was able to install WordPress and I started working on the website at the same time during DNS propagation. So, below is a complete guide that will let you preview website during DNS propagation by editing Hosts file in Windows/MAC.

Preview/Access Website during DNS Propagation

In windows there is a Hosts file that is checked before your computer looks for DNS of each domain you access. We will be editing that Hosts file and assign the IP address of the new server to that domain. Hosts file in windows can also be used to block certain websites on computer.  After previewing or completing the initial working on website, you can remove the newly added line from the Hosts file.

Please note that In Windows 7 & 8, you will not be able to edit the Hosts file directly from its original location and that’s why we will be editing it indirectly. You will need to run Notepad as administrator in order to makes to your Hosts file via it.

How to Edit Hosts File In Windows

1- For Windows XP/Vista/NT/ Windows 7/ Windows 8, move to the following path and locate the hosts file:  


Hosts file location in Windows

2- Copy that file and paste it somewhere else as backup. The Hosts file will contain data in the given form:  localhost

3- Copy the Hosts file again and paste it on your desktop in order to make changes to it. Edit this new hosts file with notepad and add the following link at the end of it:

4- Replace the IP address in the above line with the IP address of your server & also replace the domain with your own. For Hostgator, you can get the server IP address from the left sidebar after logging into your cpanel. You can also contact support of your web hosting and ask them for server IP address.

Hostgator Server IP Address

How to Edit hosts file in Windows 7

5- Now cut/copy this file and replace the original Hosts file present at C:windowssystem32driversetc with it.

6- Finally restart your web browser and then you will be able to access/preview website.

If you face any problem while previewing website before Domain Name Server (DNS) propagation then feel free to discuss it below. Cheers!

Share with Friends