Editing the hosts file
What is the Hosts File?
The hosts file tells your computer which IP address to use for a specific domain name, overriding public DNS. This is useful for testing a website on a new server before updating DNS publicly.
Common use case: You’ve built a new website on our servers but your domain still points to your old host. You can edit your operating system’s “hosts” file to point a domain at a given IP to preview the new site before going live.
Before You Start
You’ll need:
- Server IP address (find this in your hosting control panel or contact support)
- Your domain name
- Administrator access to your computer
macOS and Linux
Step 1: Open Terminal
- macOS: Search for “Terminal” in Spotlight (Cmd + Space)
- Linux: Use universal search (Ubuntu, Fedora, Almalinux etc.)
Step 2: Edit the Hosts File
- Type:
sudo nano /etc/hosts - Enter your administrator password when prompted
Step 3: Add Your Domain
Add these lines at the bottom (replace with your IP and domain):
| 194.110.243.194 yourdomain.uk 194.110.243.194 www.yourdomain.uk |
Optional – IPv6:
| 2a00:b980:2::242 yourdomain.uk 2a00:b980:2::242 www.yourdomain.uk |
Step 4: Save and Exit
- Press Ctrl + O to save
- Press Enter to confirm
- Press Ctrl + X to exit
- Close Terminal
Microsoft Windows
Step 1: Open Notepad as Administrator
- Click Start or press the Windows key
- Type “Notepad”
- Right-click Notepad → Select “Run as administrator”

Step 2: Open the Hosts File
- In Notepad: File → Open
- Navigate to:
C:\Windows\System32\Drivers\etc\ - Change file type dropdown to “All Files (.)”
- Select “hosts” and click Open

Step 3: Add Your Domain
Add these lines at the bottom (replace with your IP and domain):
| 194.110.243.194 yourdomain.uk 194.110.243.194 www.yourdomain.uk |
Optional – IPv6:
| 2a00:b980:2::242 yourdomain.uk 2a00:b980:2::242 www.yourdomain.uk |
Step 4: Save and Close
- Press Ctrl + S or File → Save
- Close Notepad

Testing Your Changes
- Close and reopen your browser (or clear browser cache)
- Visit your domain – it should now load from the new server
- Check the IP by opening Command Prompt/Terminal and typing:
| ping yourdomain.uk |
Important: Remove Entries After Going Live
⚠️ Once your DNS is updated and live, remove the hosts file entries by:
- Repeating the steps above
- Deleting the lines you added
- Saving the file
Why? Leaving these entries will cause your computer to always use the old IP, even after DNS changes.
Finding Your Server IP Address
- Check your hosting control panel (cPanel, Scout, etc.)
- Look for “Server Information” or “IP Address”
- Or contact support at www.jolt.co.uk/support/ and we’ll provide it
Troubleshooting
Changes not working:
- Close and reopen your browser completely
- Clear browser cache (Ctrl + Shift + Delete)
- Flush DNS cache:
- Windows:
ipconfig /flushdnsin Command Prompt - macOS:
sudo dscacheutil -flushcachein Terminal - Linux:
sudo systemd-resolve --flush-caches
- Windows:
Can’t save hosts file (Windows):
- Make sure you opened Notepad as Administrator
Can’t edit hosts file (Mac/Linux):
- Make sure you used
sudoin the command
Need Help?
Our support team can assist with hosts file configuration! Contact us at www.jolt.co.uk/support/