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:
You may also prefer to add the www version:
18.104.22.168 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:
Using this technique you should be able to access your site while DNS is being propagated.
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.