Latest news from 5wire Networks

Learn how to modify your hosts file to sanity check your website before changing your nameservers or DNS

When migrating a domain or website, you may wish to test the new environment before updating your nameservers or DNS settings.

Modifying the Hosts File allows us to do such a task. By modifying the hosts file, we are spoofing our machine to be able to force it to look at a different IP address than the one the rest of the internet is looking at.

Once you have followed the step for either macOS/Linux or Windows below, you should be able to see your website on your new server. 

macOS and Linux

To modify your /etc/hosts file on your machine if running macOS or Linux, please do the following –

  1. nano /etc/hosts
  2. Add the server’s IP address (you can find this in your Welcome Email or cPanel) and domain name under the last try in the file (see below),
  3. Save your changes,
  4. Either reload your web browser or open a new Private Browsing / Incognito window. 

93.189.2.226 example.com 

You may also add subdomains, which we haven’t covered adding in this guide –

93.189.2.226 example.com hello.example.com 5wire.example.com trees.example.com

Remove or comment out the line once you have completed Step 8.

Microsoft Windows

To modify the /etc/hosts file on a Windows machine, please do the following –

  1. Open the Start menu.
  2. If you use Windows 8 or Windows 10, type Win+X on the keyboard or click the Windows icon in the lower-left corner of your desktop interface, or if you use Windows 7 or Windows Vista®, click Start,
  3. Enter Notepad in the search text box,
  4. Right-click Notepad and select Run as Administrator,
  5. In Notepad, open the following file: C:\Windows\System32\Drivers\etc\hosts
  6. Add the server’s IP address (you can find this in your Welcome Email or cPanel) and domain name under the last try in the file (see below),
  7. Save your changes,
  8. Either reload your web browser or open a new Private Browsing / Incognito window. 

93.189.2.226 example.com 

You may also add subdomains, which we haven’t covered adding in this guide –

93.189.2.226 example.com hello.example.com 5wire.example.com trees.example.com

Remove or comment out the line once you have completed Step 8.

Sanity check my host file is pointing to the right IP

A quick way to check you are viewing your website on the new IP address is to ping your domain.

macOS/Linux
  1. Open the Terminal,
  2. Type ping example.com
  3. If the IP address corresponds to the one you set in the host file, it means you are seeing your website on your new web hosting package. 
Microsoft Windows
  1. Open cmd.exe
  2. Type ping example.com
  3. If the IP address corresponds to the one you set in the host file, it means you are seeing your website on your new web hosting package. 

 

25% DISCOUNT FOR LIFE

Life time discount when you purchase your first order. Applies to Web Hosting, Reseller Hosting, and Cloud Servers.

Free Domain included on yearly Web Hosting plans.

Use code WEBOFF at the checkout!

Terms and Conditions apply. Voucher code is only valid for new customers.