We can test the newly migrated website prior to updating the DNS and check whether it is loading as expected by editing the hosts file on our local machine.
The 'hosts' file location varies as per the OS.
Below is the guidelines on how to edit the hosts file on Windows.
When we add the entry in the hosts file, we tell our machine to resolve the website to the respective IP before resolving to the DNS so that the web request goes to that specified IP.
This allows you to access the website normally, but have it load from a different server.
The entry should be added with below syntax:
10.10.10.10 mywebsite.com www.mywebsite.com
Once the changes are made and the line is added, you can simply browse the website normally you access for e.g. http://mywebsite.com
Once the website is tested, please do not forget to remove the entry from the hosts file.
Step 1: Go to start menu or Press windows key. Type Notepad, but do not press enter.
Step 2: Right click on Notepad and click Run as Administrator
Step 3: Enter the login credentials if you get the popup for login, otherwise click Yes.
Step 4: Click File > Open
Step 5: Navigate to C:\Windows\System32\drivers\etc.
- First navigate to your C: drive(Windows:C)
- Then navigate to the Windows folder
- Then find the System32 folder
- Then select drivers folder
- Then locate the etc folder
Step 6: Change 'Text Documents (*.txt)' to 'All Files'
Step 7: Select 'hosts' and click 'Open'.
Step 8: Add the IP address of the server that is hosting your website. Press Tab and add the domain name of your website.
(Ensure that you use the details provided in the migration email for this section.)
Step 9: Once done save the file by clicking on 'File' and then 'Save'
Step 10: Once the hosts file updated, run below command in command prompt to check whether the website is pointing to the new IP:
If it response from the new IP 10.10.10.10, it means hosts file changes are reflected. Now you can browse the site in the browser.