How To Test Website Without Changing DNS

There are some ways to preview your website before changing DNS :- You can use your local computer's HOSTS file,Your local system will use the entries in your HOSTS file before it looks up the DNS information for your domain.This Knowledgebase article provide some instructions to edit the HOSTS file on Windows XP/2003/Vista/7, and Apple's Mac OS X.

Note :- Once you finished your testing, please remember to remove these custom lines that you have added to check the preview.

Windows :-

1. First Locate the HOSTS file on your local system/computer,Usually it's in one of the following locations:-
 
 Windows XP/2003/Vista/7 :- C:\windows\system32\drivers\etc\hosts

2. Now Open this file with a text editor such as Notepad or Wordpad,Right-click on Notepad and select the option to Run as Administrator - otherwise you may not be able to open this file for editing.
3. You may consider to take backup before edit the original file so you have an original copy of the file that you can restore later.Now you will see two columns of information, the first containing IP addresses and the second containing host names. By default, a windows hosts file should be similar to the following:-

------------
127.0.0.1 localhost
------------


You can add additional lines to this file that will point requests to your domain to your new server's IP address. Example :-

-------------------------------------
127.0.0.1 localhost
172.10.10.10 yourdoaminname.com
172.10.10.10 www.yourdoaminname.com
-------------------------------------


4. Save your changes.
5. Restart any currently open browsers,You may also consider to flush your DNS cache, In Windows XP, go to Start, and then Run, then type "cmd" and hit enter. Type the following:-

-----------
ipconfig /flushdns
-----------


6. Now Visit your website using http://yourdomainname.com or http://www.yourdomainaname.com


Mac OS X :-

1. Open Terminal, which should be in Applications, and go to Utilities folder.
2. You may consider to make a backup copy of your existing hosts file first :-


# sudo cp /private/etc/hosts /private/etc/hosts.bak
 

Enter your user password when it prompt.

3. Type the following command to edit your hosts file:-

# sudo vi /private/etc/hosts

You will see a file with contents similar to the following:-

-----------------------
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
------------------------


Add your domainname and IP address to the bottom of the file. Example:-

------------------------
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
172.10.10.10 yourdoaminname.com
172.10.10.10 www.yourdoaminname.com
------------------------

Help Vi Editor :- Press "i" to enter "insert mode" so you can type and copy/paste. Press "Esc" to exit "insert mode" when you are done modifying the file. Type ":wq" to save and quit.

4. You may also need to grant sudo privileges to yourself,if you got a permission error in Step 2. In your "Help" menu, search for "root" and select the instructions for "Enabling the root user".
5. Restart any currently open browsers,You may also consider to flush your DNS cache.

# dscacheutil -flushcache

6. Now Visit your new site using http://yourdomainname.com or http://www.yourdomainname.com

Note :- Once you finished your testing, please remember to remove these custom lines that you have added to check the preview.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

yum is not installed

Yum is not installed by default in all CentOS based VPSs.To install yum :1. Login to VZPP Power...

How to clear DNS cache from your PC?

To clear the DNS cache resolver from your Windows machine, kindly follow the steps below.1. Click...

How to do traceroute

Traceroute is a diagnostic tool that displays the route and transit delay of packets across the...

Show hidden files in Filezilla

Filezilla and even some FTP clients are set not to show hidden files by default.Hidden files in...

Creating a custom error page (in Linux)

In Linux VPS, to create a custom error page you must do the following: Create your desired...