Web Site Migration Testing: How to Verify on the Production URL and Edit the hosts File
When migrating a website to a new server, it is extremely important to verify that the site functions correctly in the production environment before actually making it public.
In this article, we will explain how to edit the hosts file on Windows and Mac PCs, specify a temporary domain and IP address, and test the migrated site using the production URL.
What is the hosts File?
The hosts file is a system file used to map domain names to IP addresses. It allows you to access a specific IP address with a specific domain name without waiting for DNS changes to propagate.
How to Edit the hosts File
For Windows
- Open the Start menu and search for “Notepad.”
- Right-click Notepad and select “Run as administrator.”
- In Notepad, open the file C:\Windows\System32\drivers\etc\hosts.
- At the end of the file, add the IP address of the destination server and the production domain. An example is shown below.
123.45.67.89 honban.xxxx.com - Save the file and close it.
For Mac
- Open “Applications” > “Utilities” > “Terminal.”
- In Terminal, type sudo nano /etc/hosts and press Enter.
- Enter the administrator password.
- At the end of the file, add the IP address of the destination server and the production domain. An example is shown below.
123.45.67.89 honban.xxxx.com - Press Ctrl + O, then press Enter to save. Press Ctrl + X to exit.
Running the Test
After editing the hosts file, clear your browser cache and access the site using the production domain (e.g., honban.xxxx.com). If configured correctly, the site on the destination server should be displayed.
Important Notes
- Please edit the hosts file carefully. Incorrect entries may cause issues with your internet connection.
- After completing the test, do not forget to revert the changes made to the hosts file.
- Security software may block changes to the hosts file. In such cases, you may need to temporarily adjust the software settings.
Summary
Migration testing is extremely important to prevent issues in the production environment in advance. By correctly editing the hosts file, you can test the migrated site using the production URL without waiting for DNS changes. Follow the steps outlined in this article to perform testing safely.
*Please use this information at your own risk if you choose to reference it.
