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.
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
- Click the Start menu, type Notepad, right-click it and choose Run as administrator.
- In Notepad, go to File > Open and browse to:
C:\Windows\System32\drivers\etc - Change the file type dropdown from "Text Documents" to All Files, then open the file named
hosts. - Add your line at the bottom of the file, then save with File > Save.
- Flush your DNS cache by opening Command Prompt and running:
ipconfig /flushdns
macOS
- Open Terminal (Applications > Utilities, or search for it with Spotlight).
- Run the following command and enter your Mac password when prompted:
sudo nano /etc/hosts - Use the arrow keys to move to the bottom of the file and add your line.
- Press Ctrl + O then Enter to save, and Ctrl + X to exit.
- Flush your DNS cache:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Linux
- Open a terminal and run:
sudo nano /etc/hosts - Add your line at the bottom of the file.
- Press Ctrl + O then Enter to save, and Ctrl + X to exit.
- 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.
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.