How to check a website in a remote server before DNS change
In all migrations, we may wish to check the domain’s functionality and fix any errors preset to make the dns change smoother and perfect. So just thought to add this in our blog too 🙂
Some control panel offer site preview, especially Plesk using which we can take a look on domain hosted in that domain. But in others like cPanel, Directadmin and those without any control panels, we may need to check this using local hosts file or by changing the A record on a temporary basis.
Best method is to check websites using your local “hosts” file in your PC / Laptop. Below is the steps using which one can test a website hosted in a remote server without changing the name server.
1. Locate the hosts file in your computer. Typically it is in one of the following locations:
Windows NT/2000/XP/2003/Vista/7 — C:\windows\system32\drivers\etc\hosts
Windows 95/98/Me — C:\windows\hosts
2. Open this file using Notepad and add the required hosts file entries and save the changes. You may need Administrator privilege to get this done in Windows. Right-click on Notepad from Start Menu and select the option to Run as Administrator, else you will not be able to save the changes.
3. Restart any currently open browsers. (please do not use browsers in which you use a proxy) . Inorder to flush DNS cache in Win7
Go to Start Menu, Search for cmd and open it . Once opened, use the below command to clear the dns cache
5. Visit your new site from the ip which you have mentioned in the hosts file.
If using Mac Os, there is no change in the steps, just the file locations and command to clear the cache will change.Hosts file location : /private/etc/hosts
To clear the dns cache : dnscacheutil -flushcache
If using LINUX OS, just use the file location listed below
Open a terminal window.
Edit the Hosts file: /etc/hosts as root with a text editor.
Example: sudo nano /etc/hosts
If you are not using the above 3 Os, then you can use this link for locating the hosts file