One of the most annoying and time consuming factors in switching hosts is waiting the Internet to catch up with the changes you’ve made. Typically, once you switch your nameservers you have to wait anywhere from 8 to 24 hours (and in some cases more) for the information to flow through Google and all the other spiders so your website can be viewed as it is in real time. Sometimes, even when you can have instant results like with CloudFlare, you want to make sure everything looks right on your new host before you allow it to go live to the public. You can do this by forcing your local computer to resolve the DNS of your domain for a specific IP address by editing the local ‘hosts’ file.
These instructions are for Windows 10, but will work for most previous versions.
- Go to Windows Accessories in the Start Menu -> All Apps and find NotePad. Right click on the NotePad icon and click on the menu option “More” then click on “Run As Administrator”. It will ask if you really want to do this, just click yes.
- In the NotePad window click File->Open and navigate to c:/Windows/System32/drivers/etc and find the ‘hosts’ file. If you don’t see anything in the window make sure that the search box is set to ‘All Files’ not just .txt.
- Once open find the section which looks like this – and enter the followingIP_address domainname.com
where IP_address is the IP address of your account on the server and domainname.com is your actual domain name (do this for all subdomains, too):under the section of the file that says –
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
By the way DO NOT add the # sign at the beginning of the lines you type in.
This is where I found the information that helped me resolve this problem –
- Now save and close the ‘hosts’ file
- Go to Start Menu -> All Apps -> Windows System – > open the Command Prompt. When the cmd prompt window opens type in ipconfig /flushDNS. This will clear the DNS cache allowing your browsers to resolve the new information you’ve input in your ‘hosts’ file.
- Open your browser and type in your domain name. This should take you to the version on the new host server.
- Alternatively you can use the service https://hosts.cx/ . You will need to add your server’s IP address ‘XXX.XXX.XXX.X’ to the ‘Server Address’ field and whateveryourdomainis.com to the ‘Website Name’ field. It will give you a special URL with which to view the new site. The only problem is it will not properly show your media files.
Have any questions? Please feel free to leave them in the comments below. I love doing research so if I don’t know I’ll find out for you :).
Are you looking to switch web hosts but not sure which to choose? Check out NameCheap. I just recently switched. Not only are they one of the least expensive options out there, but their service is bar none the best I’ve experienced in all my years of hosting websites and blogs.
This post contains affiliate links. Clicking on these links may result in compensation for this blog.