If you’re moving your website over to a new reliable offshore hosting provider and also thinking of testing and ensuring that it’s working before updating the DNS, you can use your local system’s hosts file to complete this. In this article, I’ll walk you through how to use your computer’s hosts file to accomplish these goals.
- Discover the Hosts File
Windows: The location of the hosts file is
C:\Windows\System32\drivers\etc\hosts
macOS and Linux: You can locate it by searching for /etc/hosts
or /private/etc/hosts
- Retain a Copy of the Host’s File
To avoid the potential risk of losing information, creating a backup of the hosts file should be considered a prerequisite for any changes.
- Adjust the Hosts File:
1. Use a text editor with administrative power to unblock access to the host’s file.
2. Have a text editor that has administrative privilege open up the host’s file.
Notepad should be used with administrative rights for Windows users.
Include the subsequent lines in the document on a novel row at the end.
SERVER_IP_HERE example.com
SERVER_IP_HERE www.example.com
Replace your actual server IP address in place of “SERVER_IP_HERE” and your domain name instead of “example.com.”
- Save the Hosts File
Save the hosts file (do not use “Save As” – keep the file as-is with your added redirect entry).
- Restart Your Internet Browser:
Make sure to close your browser and re-open it before accessing your website. Your website will now be loaded from your new hosting provider without updating your nameservers.
Keep in mind that this approach is only applicable to the local system.