2 min read Sep 26, 2026

How to Edit Your Hosts File to Preview a Site Before Changing DNS

Point your own computer at your FimuroHost server before switching DNS by editing the hosts file on Windows, macOS or Linux. Step-by-step instructions inside.

FimuroHost Team

FimuroHost Team

Technical Writer

Share Article

Your computer's hosts file lets you override DNS for chosen domains on that one machine. It is the best way to test a migrated site on its real domain name, including SSL and absolute links, before you change nameservers for everyone.

Before you start

  • Find your hosting IP address: open StackCP for the site and look in the account information panel on the right. You normally need the IPv4 address.
  • You need administrator rights on your computer.

The line to add

Each entry is the IP address followed by every hostname you want to redirect, separated by spaces:

203.0.113.10  yourdomain.com  www.yourdomain.com

Replace the example IP with your own. Include every version of the name you will visit, including www and any subdomains, or some requests will still go to the old server.

Windows 10 and 11

  1. Click Start and type Notepad.
  2. Right-click Notepad and choose Run as administrator.
  3. Choose File > Open and open C:\Windows\System32\drivers\etc\hosts (set the file type filter to All Files).
  4. Add your line at the bottom and save.
  5. Optional: open Command Prompt and run ipconfig /flushdns.

macOS

  1. Open Terminal (Applications > Utilities).
  2. Run sudo nano /etc/hosts and enter your Mac password.
  3. Add your line, then press Control+O and Enter to save, and Control+X to exit.
  4. Clear the DNS cache:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Linux

  1. Open a terminal and edit the file with your preferred editor, for example sudo nano /etc/hosts.
  2. Add your line and save.

When you have finished

Remove or comment out the line (put # at the start) once testing is done. If you forget, your computer will keep using the address in the file even after the real DNS changes.

Tips

  • Browsers keep their own DNS cache. If nothing changes, close and reopen the browser or try a private window.
  • Secure DNS (DNS over HTTPS) in some browsers can ignore the hosts file. Turn it off temporarily if your test does not work.

Need help?

If anything here does not work as described, our team is happy to take a look. Open a support ticket from your client area or message us on WhatsApp at 01818160926.

FimuroHost Team

Written by

FimuroHost Team

Technical Writer