Last Updated: February 25, 2016
·
614
· bretterer

Migrating a wordpress (or any other) site

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 1.1.1.1. These can be changed out for anything you need them to be.

  1. Set up the destination server how you need to for the final product.

  2. 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

  1. add the line `1.1.1.1 xyz.com www.xyz.com and save

  2. 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 1.1.1.1 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.