If you buy a website or order a new domain, you sometimes want to point it to another web hoster or your own virtual or dedicated server. This can also happen when you migrate a site to a new server, for instance from a shared hosting account to its own server.
Most webmasters do this by changing DNS server data to point to the new server, or by changing IP or hostname addresses if the same nameservers are used. The phase that begins then is called DNS propagation and can take up to 48 hours.
What this means is that DNS servers on the Internet need to change the DNS information so that users who open the website in a web browser are routed to the right (new) web server.
This can be problematic for webmasters who face the same DNS propagation wait time especially if they want to make sure that the website works fine at the new hosting location before users are rerouted to the new destination.
There is one easy way of accessing the website at the new web server even if the DNS is still pointing to the old: The Hosts file.
The Hosts file can be used to map a domain name to an IP address. All that needs to be done to work with a website before DNS propagation is to map the domain name to the new IP address. Here is how this is done in the Windows operating system.
The Hosts file in Windows is located at C:\Windows\System32\drivers\etc\Hosts
You might need to change the rights of the current logged in user first so that the file becomes writable.
All you should see when opening the Hosts file with a text editor is a comment section on top unless someone has already added new entries to it.
New entries to the Hosts file can be added after the last line.
To do that add the IP address of the new server and then the domain name of the website like 188.8.131.52 example.com with a blank in between.
All programs of the operating system will now open the website using the new IP address even if the DNS servers are still routing to the old server.
This gives webmasters an excellent opportunity to edit these websites before the DNS propagation has finished.
All allow you to enter a domain name and record to check DNS servers around the globe to find out if they carry the old or new record.Advertisement
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.