Often when switching hosts or signing up at new host you’ll have to set your domain’s name servers to your new website host’s name servers. This step is necessary because it allows your new host’s servers to receive and serve requests for your website from your visitor’s browsers. However the Domain Name System (DNS) is such that it takes time for this new mapping between your domain name and your host’s servers to propagate across the Internet.
Depending on your new host’s DNS servers and your Internet Service Provider it can take anywhere from a few hours to a few days before you will be able to access your website via the domain name. If, in the meantime, you want to upload files to your website and test it you will need to edit your HOSTS file to manually map your domain name to your web host’s IP address.
The first step is finding out the IP address of your new host’s servers. A lot of enlightened hosts include this information in the email they send you when you sign up with them. In that case you can skip to the next step. But if your host does not provide with this info then you will have to do an ns lookup:
- Go to http://www.kloth.net/services/nslookup.php
- Type in your domain name, your web host’s DNS name server and make sure that the query field says A ipv4 address.
- Click on lookup and you should see your site’s new ip address.
Next open up your HOSTS file using your favourite text editor such as notepad. On Windows you can open this file by copy pasting %systemroot%\system32\drivers\etc\HOSTS into your editor’s open file window. In most cases you can also try C:\WINDOWS\system32\drivers\etc\HOSTS . Keep in mind that the file has no extension.
On Linux you will usually find this file at /etc/hosts.
Open up the file and on a new line type in your host’s ip address followed by a space and your domain name. For ex:
208.113.192.208 websitetheme.com
You may also prefer to add the www version:
208.113.192.208 websitetheme.com www.websitetheme.com
Save the file and try to access your site by typing in your domain name in your favourite browser. It should work now! To enable ftp access add the ftp subdomain:
208.113.192.208 ftp.websitetheme.com
Using this technique you should be able to access your site while DNS is being propagated.
Troubleshooting
If you still have problems the cause is likely operating system or browser level caching of the old IP address. To address that ( 🙂 ) you can take the following steps:
- On Windows XP go to start -> run type in cmd.exe and press enter. On Windows 7 just go to start and type in cmd to get the command prompt option.
- Type the command “ipconfig /flushdns” in the command prompt window and press enter.
The above steps clear your OS level DNS cache. Try accessing your site now. If it still doesn’t work you will have to clear your browser DNS cache. On Firefox this can be done simply by installing and using the DNS flusher extension. On other browsers you will have to consult the browser documentation or search online.
Or you can use OpenDNS, and use CacheCheck to get your domain updated instantly for OpenDNS customers. http://cache.opendns.com/
Just saying. 😉
John Roberts
OpenDNS
Yeah you’re right 🙂 . I read about this on namepros and I thought hey isn’t that just so much simpler :p . But I guess it doesn’t hurt to have other options. Especially for people who *have* to use their ISPs DNS servers or perhaps are behind a firewall.
Thank you. I appreciate your help.
Thanks this really helps 🙂
the ip address usually included when we purchase the hosting
still doesn’t work for me 🙁
I have the updated the article with some new tips. Please try them out!
Really Helpful . . . 🙂
Does this also work with shared hosting?
Yes
excellent article, fixed my problem! lifesaver!!
cheers 🙂
Thank you Abdussamad! It works! Great!
after trying over ten different methods I FINALLY managed to solve this problem following your instructions. Everything works perfectly. ns lookup also helped, because for some reason IP address included in hosting purchase information didn’t work. Thank you for this article!
Well I’m glad that this article is still proving useful to people after all these years :).
well, you saved me 🙂 A client wanted his website built over the weekend, but I couldn’t access it, no other methods helped. But this worked like magic. I can’t thank you enough!