This instruction will be useful for anyone who has to test new website being build, or website being transferred to new server, prior to DNS change when all you have is a new website's IP address. You can make changes on your local machine to associate web address (URL) with known IP address and test how the website performs when called via that URL. Once local settings are changed, the website is ready to be tested in web browser on your local machine with its actual URL. After testing is complete, make sure to delete these temporary settings so they do not interfere with post-launch testing.
To test with valid URL instead of IP, change localhost file to use test URL for that IP.
1. Applications -> Utilities -> Terminal
2. sudo nano /private/etc/hosts
3. Once the hosts file is open, use the arrow keys to navigate to the bottom to make any modifications.
4. Add line [server ip address being tested] [website address without “www.”] [website address with “www.”]
5. When finished, press Control + O followed by Enter to save changes to /private/etc/hosts.
6. Press Control + X to exit out of nano.
7. Quit Terminal when done.
1. Open C:\WINDOWS\system32\drivers\etc\hosts with Notepad
2. Add line
[server ip address being tested] [website address without “www.”] [website address with “www.”]
3. Save hosts file