- If you’ve moved your domain to a new server but the DNS hasn’t propagated yet,
- If you want to test your website before making the new version live,
- Or if you want to detect any potential issues before the redirection process is complete, you can view your website by editing the HOSTS file.
You can follow the steps below to access the HOSTS file.
- Search for “Notepad” from the Start menu.
- Right-click on Notepad and select “Run as administrator.”
- In the Notepad window that opens, click on “File > Open.”
- In the dialog that appears, type “C:\Windows\System32\drivers\etc” into the file path field and press the Enter key. This will take you to the folder where the HOSTS file is located.
- In the “File type” dropdown, change the selection from “Text Documents (.txt)” to “All Files (.*).”
- From the list of files, select the “HOSTS” file and click the “Open” button.
- An example of a “HOSTS” file will look like the one shown below.
- Lines starting with “#” in the HOSTS file are considered comments and are used for informational purposes only. The important points are:
Example;
- If you are sure you have completed the steps correctly, save the HOSTS file by clicking “File -> Save” or pressing “Ctrl+S” then close the file.
After completing these steps, you need to clear your DNS cache and browser cache.
You can check the link below for detailed instructions on how to clear the DNS cache and browser cache:
Link: https://www.fastpanda.co.uk/knowledge-hub/how-to-clear-dns-cache-and-browser-cache/
After clearing your DNS and browser cache, you can check whether the IP address you added to the HOSTS file is being resolved correctly by performing a ping test.
You can follow the steps below to perform a ping test.
- On the Start screen, type “cmd.exe” and press “Enter”. A window like the one below will appear.
- Type “ping yourdomain.extension” and press Enter.
- If the result screen shows that the domain is being resolved to the IP address you provided, as shown below, it means the process has been successfully completed.(The image is for illustration purposes only. You will see results based on the IP address you directed.)
After this process, you can access your website and perform your checks.
Note: The changes you made are only effective on your local computer.