Do you ever have to migrate a wordpress (or any other) site and not sure how to test it before you make a DNS change? There is an easy setup for doing this. In this we will use the domain www.xyz.com as our example. which will be hosted on the ip 220.127.116.11. These can be changed out for anything you need them to be.
Set up the destination server how you need to for the final product.
Now you need to change your hosts file.
On mac, open terminal and run the command
sudo vi /etc/hosts
On windows, open
Windows/System32/drivers/etc/hosts as an administrator in notepad
add the line `18.104.22.168 xyz.com www.xyz.com and save
visit www.xyz.com and you should see the new site.
After these steps, the domain will act like it is being hosted at the new location because your computer will use the resolution of xyz.com to the ip 22.214.171.124 and will not look at your DNS you currently have set up.
After you are done working on the site, make your DNS changes and remove the entry from the hosts file.