How to View a Website Before DNS Propagation

When you purchase a new domain and hosting space, you must update the name server information provided by the hosting provider in your domain control panel.

This will point your domain to the associated hosting account where your contents are placed.

Typically, DNS propagation can take up to 48 hours to complete.

During this time, you can not access your domain on web browser.

If you have uploaded designed contents and want to see them before domain propagation.

Yes, you can browse your website in the web browser by skipping DNS lookup using the below three methods.

  • Adjust the hosts file
  • Use cPanel temporary or shared URL
  • Create a Subdomain

The first method is common to everyone, but you need to add some configuration about your website.

You do not need to make any changes if your website is hosted on a cPanel managed server.

Method-1: How to View a Website Before DNS Propagation Using hosts File

This is common for Linux and Windows operating systems.

The “/etc/hosts” file is a plain-text file used by all operating systems to map hostnames to IP addresses.

The file contains one line per IP address with the following information.

IP_address canonical_hostname [aliases...]

It is a local DNS server that is used primarily to bypass DNS resolution.

For example, a match found in the “/etc/hosts” file will be used before any DNS resolution.

In other words, the DNS resolution is not performed if the given match is found in the “/etc/hosts” file.

For example, to access “example.com” or “www.example.com”, it is sufficient to add the following lines to your host file.

Make a note, you need to update your server public IP and your website name instead.

# vi /etc/hosts

192.168.1.100 example.com www.example.com

On Microsoft Windows systems, the hosts file is located at C:\Windows\System32\drivers\etc. Open the Hosts file with a text editor and update the required information’s.

Once the hosts file updated, you may need to clear the web browser cache.

Method-2: How to View a Website Before DNS Propagation Using the cPanel Temporary or Shared URL

On cPanel servers the website can be accessed with the help of a shared URL which is “http://cPanel_Server_IP/~cpanelusername/”.

Method-3: Create a Subdomain

Most cPanel hosting providers can disable this feature due to security reasons.

In this case you can create a subdomain on your existing hosting account to achieve this. This is common for all types of control panel hosted server.

For example: “new_site.example.com”.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...