How to preview your site before the DNS changes

Before going live, you may want to preview your site on the new server before you’ve updated your domain’s DNS.

This article will show you a way to test your website by modifying a configuration file on your computer called the hosts file.

Hosts file format

The hosts file contains multiple lines. Each line will contain an IP address, followed by one (or multiple) spaces, follwed by a domain name. For example:
123.123.123.123 yourdomain.com
To correctly configure your hosts file. We recommend adding (or modifying, if you have already added them) 2 lines at the end of the file, one for your domain with and without the www, as follows:

123.123.123.123 yourdomain.com
123.123.123.123 www.yourdomain.com

  • Replace 123.123.123.123 with the actual IP address of your website. This can vary depending on your service. Please contact hosting.ca if you don’t know this.
  • Replace yourdomain.com by your actual domain name.

How you edit your hosts file will vary depending on which operating system you are using on your computer:

For Windows 8 or Windows 10

  1. Click on the Windows key
  2. Enter Notepad in the search field
  3. In the search results, right-click on Notepad and select Run as Administrator
  4. In Notepad, open the file: C:\Windows\System32\Drivers\etc\hosts
  5. Make your changes as described above and save your file.
  6. Restart your browser and, optionally, empty its temporary files.

For Windows 7 or Vista

(also works on most older Windows versions as well)

  1. Click on the Windows key or Start button
  2. Click All Programs > Applications
  3. Right-click on Notepad and select Run as Administrator
  4. Click Continue to execute Notepad as an administrator
  5. In Notepad, open the file: C:\Windows\System32\Drivers\etc\hosts
  6. Make your changes as described above and save your file.
  7. Restart your browser and, optionally, empty its temporary files

For Linux

  1. Modify and save your changes with your preferred text editor (vi or nano). The file is called: /etc/hosts

You’re done!

Tags: