Webfort

Previewing Your Website Before Changing DNS Print

  • 0

When you're migrating a website to Webfort, or building a new site before your domain goes live, you'll often want to see exactly how it will look and behave on our servers before pointing your domain at us. The easiest way to do this is by editing your computer's hosts file.

The hosts file tells your computer to load a domain from a specific IP address, overriding public DNS. The change only affects your own computer β€” visitors will continue to see your live site as normal until you update your DNS or nameservers.

Before you start: You'll need the IP address of your hosting server. You can find this in your welcome email, or by opening a support ticket and we'll happily confirm it for you.

The line you'll be adding

Whichever operating system you use, you'll be adding a line to the hosts file in this format:

203.0.113.10    yourdomain.co.uk www.yourdomain.co.uk

Replace 203.0.113.10 with your Webfort server IP, and yourdomain.co.uk with your actual domain. Including both the bare domain and the www version ensures the preview works however your site is configured.

Windows 10 and 11

  1. Click the Start menu, type Notepad, right-click it and choose Run as administrator.
  2. In Notepad, go to File > Open and browse to:
    C:\Windows\System32\drivers\etc
  3. Change the file type dropdown from "Text Documents" to All Files, then open the file named hosts.
  4. Add your line at the bottom of the file, then save with File > Save.
  5. Flush your DNS cache by opening Command Prompt and running:
    ipconfig /flushdns

macOS

  1. Open Terminal (Applications > Utilities, or search for it with Spotlight).
  2. Run the following command and enter your Mac password when prompted:
    sudo nano /etc/hosts
  3. Use the arrow keys to move to the bottom of the file and add your line.
  4. Press Ctrl + O then Enter to save, and Ctrl + X to exit.
  5. Flush your DNS cache:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Linux

  1. Open a terminal and run:
    sudo nano /etc/hosts
  2. Add your line at the bottom of the file.
  3. Press Ctrl + O then Enter to save, and Ctrl + X to exit.
  4. On most modern distributions you can flush the DNS cache with:
    sudo resolvectl flush-caches
    If that command isn't available, simply restarting your browser is usually enough.

Viewing your preview

Open your browser and visit your domain as normal. You should now be viewing the copy of your site hosted with Webfort. If you still see the old site, fully close and reopen your browser, or try a private/incognito window, as browsers cache DNS lookups independently.

A note on SSL warnings: If your site doesn't yet have an SSL certificate issued on our servers, your browser may show a security warning during the preview. This is expected β€” certificates are usually issued automatically once your DNS is pointed at us. It's safe to proceed past the warning for your own preview.

When you're finished

Once you've completed your preview (or after your DNS change has gone live), remove the line you added from the hosts file and flush your DNS cache again. Leaving old entries in place can cause confusing problems later, such as not seeing your live site after future changes.

If you run into any trouble at any stage, just open a support ticket and we'll be glad to help.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution