Have a Question?

If you have any question you can ask below or enter what you are looking for!

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

  1. Type: sudo nano /etc/hosts
  2. 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

  1. Press Ctrl + O to save
  2. Press Enter to confirm
  3. Press Ctrl + X to exit
  4. Close Terminal

Microsoft Windows

Step 1: Open Notepad as Administrator

  1. Click Start or press the Windows key
  2. Type “Notepad”
  3. Right-click Notepad → Select “Run as administrator”

Step 2: Open the Hosts File

  1. In Notepad: FileOpen
  2. Navigate to: C:\Windows\System32\Drivers\etc\
  3. Change file type dropdown to “All Files (.)”
  4. 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

  1. Press Ctrl + S or FileSave
  2. Close Notepad

Testing Your Changes

  1. Close and reopen your browser (or clear browser cache)
  2. Visit your domain – it should now load from the new server
  3. 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:

  1. Repeating the steps above
  2. Deleting the lines you added
  3. 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 /flushdns in Command Prompt
    • macOS: sudo dscacheutil -flushcache in Terminal
    • Linux: sudo systemd-resolve --flush-caches

Can’t save hosts file (Windows):

  • Make sure you opened Notepad as Administrator

Can’t edit hosts file (Mac/Linux):

  • Make sure you used sudo in the command

Need Help?

Our support team can assist with hosts file configuration! Contact us at www.jolt.co.uk/support/