Why Edit Your Hosts File?
Modifying your hosts file lets you view and test a site on one server while the rest of the world continues to see the site on another. That makes it an essential tool when migrating your website. With this method, you’re able to ensure that: Everything on the site works as expected on the new server before you update the DNS records The visitors to your existing website will not be affected by any potential issues related to different server environments before you’ve had a chance to resolve them
It’s actually a very simple process. Let’s take a look at an example hosts file:
22.214.171.124 hostulum.com www.hostulum.com
In this case, the first three entries are defaults used to configure the local network interface. You may have more or less local entries in your hosts file. You do not need to worry about them other than to note their presence. Any custom entries will go at the bottom of the file, and in this case, you can see that we have added a custom entry to the end of the file already:
1. Open your Firefox browser. 2. Click the menu button and select Options. 3. In the General panel, scroll down to Network Settings and click the Settings button. 4. In the dialog box that opens, scroll down to Enable DNS over HTTPS. 5. Uncheck the box beside Enable DNS over HTTPS. 6. Click OK to save your changes and close the window.
My custom entry specifies that any request made from my computer (via a web browser or SSH, email, or FTP client) for liquidweb.com or www.liquidweb.com will be directed to the IP address I’ve specified: 126.96.36.199. To redirect your specific request, you must add your own custom entry to the end of your file using the same format. The line for your custom entry will consist of three elements. The IP address of the server to which you want the domain name to resolve on your computer A tab or space The domain name(s) meant to resolve to the specified IP address If you’re migrating to a Liquid Web server, your migration technician will supply you with the information to add. Simply copy and paste the line into your hosts file. If your migration involves multiple IP addresses, you will have one line for each IP address, regardless of how many domain names share it.
Firefox now uses DNS over HTTPS (or DOH) by default. That means instead of checking your local hosts file or even your DNS resolver. Firefox simply makes the DNS request over HTTPS from within the browser. This behavior guarantees that the website displayed points to the IP address that the Internet sees as authoritative for that domain.
There are two primary ways to avoid this behavior while testing your new site. First, use a different browser. Chrome, Edge, Safari, and many others do not have this setting enabled by default and will continue to work as expected with a modified hosts file. The second method is to disable DOH in your Firefox browser. Follow the directions below to disable this setting.
- Open your Firefox browser.
- Click the menu button and select Options.
- In the General panel, scroll down to Network Settings and click the Settings button.
- In the dialog box that opens, scroll down to Enable DNS over HTTPS.
- Uncheck the box beside Enable DNS over HTTPS.
- Click OK to save your changes and close the window.
You can now edit your Hosts File and proceed with testing your new site like you normally would. We do recommend re-enabling this feature as it keeps you safer while browsing. The location of your computer’s hosts file depends on your operating system. Because it is a protected file that must be edited with administrative privileges, the procedure for editing also varies by the operating system.