+254725682556 +254725052660 info@ziprof.co.ke
Client Area

General Knowledge

How to Preview Your Website Before Pointing Your Domain's DNS

When you move your website to a new hosting account, it's normal to want to check that everything looks right before you point your domain's DNS at it. You can do this by editing a small file on your own computer called the hosts file, which lets your browser load your website from its new location while your domain still points elsewhere. No one else sees this preview: it only affects your computer.

Why Preview Your Website First

Once you change your domain's DNS or nameservers, it can take a few hours to fully propagate. If something is broken on the new hosting account, visitors could see errors during that window. Previewing first lets you catch missing files, broken links, or database issues while your live site is still safely running on its current host.

What You Need

  • Your website's files and database already uploaded to the new hosting account.
  • The server's IP address for the new hosting account.
  • A few minutes of access to your computer's system files.

If you don't have the server's IP address yet, you can find it by logging in to your control panel. See How to Find Your Hosting Server's IP Address and Hostname for the exact steps.

How to Edit Your Hosts File

The hosts file tells your computer to use a specific IP address for your domain name, overriding what DNS would normally return. The steps differ slightly depending on your operating system.

On Windows

  1. Open the Start menu, search for Notepad, right-click it, and choose Run as administrator.
  2. In Notepad, click File, then Open, and browse to C:\Windows\System32\drivers\etc\hosts. You may need to change the file type filter to All Files to see it.
  3. At the bottom of the file, add a new line with the server IP address, a space, and your domain name, for example: 102.0.0.1 example.co.ke
  4. Save the file, then close and reopen your browser.

On Mac

  1. Open Terminal from Applications > Utilities.
  2. Type sudo nano /etc/hosts and press Enter, then enter your Mac password when prompted.
  3. At the bottom of the file, add a new line with the server IP address, a space, and your domain name, for example: 102.0.0.1 example.co.ke
  4. Press Control+O to save, then Control+X to exit.
  5. Close and reopen your browser.

Now when you visit your domain in that browser, you should see the website on the new hosting account instead of the old one. If it still shows the old site, clear your browser cache or try an incognito/private window.

If your website uses HTTPS, you may see a certificate warning while previewing. This is expected if the SSL certificate on the new host hasn't been issued yet or doesn't match how you're accessing the site, and it will resolve once DNS is fully pointed over and the certificate is in place.

Removing the Hosts File Entry

Once you've confirmed the site works correctly and you're ready to go live, update your domain's DNS or nameservers as normal. After DNS has propagated, go back into the hosts file on your computer and delete the line you added, then save the file again.

Don't forget this step. If you leave the entry in place, your computer will keep showing you the old preview version of the site even after everything else has moved, which can be confusing when you're checking that the live switch worked.

Once you've previewed your site and you're ready to make it live for everyone, see How to Point Your Domain to a New Host.