When switching web hosts or making DNS changes, it can take up to 48 hours for the changes to propagate worldwide. However, you can bypass this wait time by manually updating your hosts file, forcing your system to resolve the domain to the correct IP instantly.
How to Modify the Hosts File
Step 1: Locate the Hosts File
The hosts file is a system file that maps domain names to IP addresses locally. Its location depends on your operating system:
- Windows:
%windir%\system32\drivers\etc\hosts
- Mac & Linux:
/etc/hosts
Step 2: Open the Hosts File
Use a text editor with administrative privileges:
- Windows: Open Notepad as Administrator and navigate to the file.
- Mac/Linux: Use the following command in the terminal:
sudo nano /etc/hosts
Step 3: Find Your Server’s IP Address
Retrieve your web server’s IP address from your hosting provider. It typically looks like this:
+===================================+ | New Account Info | +===================================+ | Domain: domainname.com | | IP: 64.69.46.210 | +===================================+
Step 4: Add the Domain and IP to the Hosts File
At the end of the file, add your server’s IP and domain name:
64.69.46.210 www.domainname.com 64.69.46.210 domainname.com
Note: Do not include http://
or https://
in the entry.
Step 5: Save and Apply Changes
- Windows: Save the file and restart your browser.
- Mac/Linux: Save and exit (
CTRL + X
, thenY
, thenEnter
), then clear your DNS cache:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Why Use the Hosts File?
- Instant DNS Propagation: No waiting for global DNS updates.
- Test Websites Before DNS Updates: Useful when migrating servers.
- Bypass DNS Issues: Troubleshoot domain resolution problems.
Need Assistance?
If you need help updating your DNS or migrating websites, UnderHost’s support team is available 24/7. Contact us via @CustomerPanel for expert guidance.