How to Test Your Website Before Changing DNS?


In some cases, when you might be transferring your websites over to Hivalidity from another provider you may want to test the website functionality without making any changes to the domain’s DNS records, i.e without pointing the site to the new server for everyone else on the internet. You can achieve this by editing the hosts file on your computer.

You need to know the new IP address of your web hosting account or server with Hivalidity. You can usually find this from the order confirmation email/details.

What is the hosts file?

The hosts file is used to map hostnames domain names to an IP Address. With the hosts file you can change the IP address that you resolve a given domain name to. This change only affects your own computer without affecting how the domain is resolved worldwide.

The location of the hosts file, depending on the operating system that you are using, is:

  • Windows – SystemRoot > system32 > drivers > etc > hosts
    By default the system root is C:\Windows, so if you are using Windows, your hostsfile is most probably: C:\Windows\System32\drivers\etc\hosts)
  • Linux – /etc/hosts
  • Mac OS X – /private/etc/hosts

Editing your hosts file


  1. From the Start Menu, search for “Notepad” (Win 8, 10) or navigate to: “All Programs -> Accessories -> Notepad” (Win XP, Vista, 7).
  2. Right click on Notepad and select “Run As Administrator”.
  3. In Notepad, click “Open” and select the fileC:\Windows\System32\Drivers\etc\hosts
  4. At the bottom of the file, add your new IP address followed by the domain name:
  5. Save this file overwriting the previous version.


  1. Most of the Linux distributions use the hosts file at /etc/hosts. You will need root/sudo access to edit this file. Use your favorite editor to open the file.
  2. To add your domain for testing purposes, in the hosts file, you need to specify what domain points to which IP address. In this example, we will use the IP address and the domain You will need to add the line:
  3. Save the file. All requests for the domain and will direct to the specified IP (

Mac OS

You should be logged in with a user with administrator privileges on your MAC.

  • Open Applications -> Utilities ->Terminal.
  • Edit the hosts file with a command line text editor such as nano by typing the following line in the terminal (the command will require your Mac user’s password): sudo nano /private/etc/hosts
  • Add your changes at the bottom of the file as shown previously.
  • Save the changes with the Control and X key combination.

Testing your Changes

Pinging the domain name is the easiest way to test if the newly configured IP is working.

To test that the domain is pointed to the correct IP in your hosts file, type the following:

PING ( 56(84) bytes of data.
64 bytes from ( icmp_req=1 ttl=58 time=1.40 ms
64 bytes from ( icmp_req=2 ttl=58 time=1.31 ms
64 bytes from ( icmp_req=3 ttl=58 time=1.36 ms
64 bytes from ( icmp_req=4 ttl=58 time=1.36 ms

The response should come from the newly configured IP:

In Linux or Mac OS X, you can use ping from the Shell or Terminal respectively. In Windows, you will need to open the command line: Press CTRL + Windows button on the keyboard. In the pop-up window, type cmd and hit enter.

If you enjoyed this article, then you’ll love Stromonic’s WordPress Hosting platform. Turbocharge your website and get 24/7 support from our veteran team. Our world-class hosting infrastructure focuses on auto-scaling, performance, and security. Let us show you the Stromonic difference! Check out our plans.

About the author

Akash Kohli

Akash Kohli is part of the Stromonic marketing team. With years of content writing experience behind him, it's one of his favorite activities. Akash takes part in the SEO of the Stromonic website and blog. His goal is to write comprehensive posts and guides, always aiming to help our clients with essential information. Akash also has a thirst for knowledge and improvement, which makes the hosting environment a perfect place for him.

Email Newsletter

Subscribe to receive inspiration, news, and ideas in your inbox.