Preview Web Site Before Changing DNS

Preview Web Site Before Changing DNS

 

In most cases, you will need to check how a web site looks and functions in a browser before switching its DNS to your new server. You have the option to override the public DNS on your LOCAL computer in order to test. This is done by editing the local hosts file. This guide will show you how do this on Windows- and Linux-based computers.

 

 

Edit Local hosts File on Windows

 

 

In order to utilize the method below, you need to be logged in to your local computer as its Administrator. Also, you need to set your Windows Explorer to Show Hidden Files and Folders.

 

1

Open Windows Explorer, and navigate to the following folder on your local Windows computer:

 

<windows_install_folder>\system32\drivers\etc

 

<windows_install_folder> should be replaced with the actual windows install folder as per your setup, i.e. C:\WINDOWS

2

Open the file named hosts with your favorite text editor.

3

Put the following two lines at the bottom of the document:

 

11.22.33.44 example.com

11.22.33.44 www.example.com

 

11.22.33.44 should be replaced with the IP address of your server, andexample.com should be replaced with the domain name of the test web site.

4

Save the changes in the hosts file.

5

Now your local browser will look for the web site associated with the test domain on the IP you entered in step 3.

 

 

On Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2012, you will need to use Run As Administrator option when you start your text editor. Otherwise, the system will not allow you to save the changes.

 

 

 

Edit Local hosts File on Linux

 

 

In order to utilize the method below, you need to start a Terminal Session on your local Linux with a user that has write access to the /etc/hosts file.

 

1

Open a Terminal Session on your local Linux.

2

Edit the file /etc/hosts with your favorite text editor:

 

#vim /etc/hosts

3

Put the following two lines at the bottom of the document:

 

11.22.33.44 example.com

11.22.33.44 www.example.com

 

11.22.33.44 should be replaced with the IP address of your server, andexample.com should be replaced with the domain name of the test website

4

Save the changes in the hosts file.

5

Now your local browser will look for the web site associated with the test domain on the IP you entered in step 3.

 

Was this article helpful?
0 out of 0 found this helpful

Have more questions? Contact our support instantly via Live Chat