I’m currently moving my website to a new hosting provider and I’d like to work on my new website without having to switch off my old website. Is there any way I can do this?
This question came up a couple of time recently on the BlueHost forums, recently by Sombeech who was working on his employer’s website. It’s a very valid question and the solution centers around a useful technique that can prove to be very useful.
First of all some background information. When you type a URL into your browser, the first thing that happens in the the URL needs to get translated into an IP address. This is a set of 4 numbers that every server on the Web needs to have. So, for example, if you had a website called http://www.LoseSomeWeight.com (a fake website that sells Phentermine), this could be hosted on a webserver with an IP address that looks like 22.214.171.124. There is a service on the Internet called DNS (Domain Name Service) that is responsible for translating domain names into IP addresses, a process called Domain Name Resolution. It’s a pretty clever system that’s really a hierarchical set of servers spread about the Internet. If your computer asks a DNS server to resolve a name it’s not familiar with, the DNS server will ask one further up the chain if it knows how to resolve that particular name, until the name is finally resolved.
Now, when you move your domain from one host to another, or even from one machine to another, the IP address of the server will change, and in order to effect this, you need to modify one of the DNS records to point at the new webserver. (This is the simple version, there’s actually another type of server called a nameserver that comes into play). Once you do this and the name has “propagated” around the Internet (a process that can take up to 48 hours), whenever someone types in the name of your website, they will be redirected to the new webserver. This new setting however, can be done just on your machine, which would let you work on your new server while everyone else is looking at the old server. Here’s how to do it.
Here’s an example, where we’re pointing the domain http://mba-geek.com to 126.96.36.199
- Go to c:\windows\system32\drivers\etc and find a file called “hosts”
- Open the file in a text editor
- Add a line that reads: 188.8.131.52 mba-geek.com
- Save the file
- Open a command prompt and run: IPCONFIG /FLUSHDNS
Your file will now look something like this:
If you open your browser, you’ll now see that you’re looking at the new version of your website and you can modify this to your heart’s content, safe in the knowledge that you’re the only person who can actually see your new changes.