Hosts File – Preview WordPress Migration

I have been moving a lot of WordPress blogs around recently, you can read my “How to Migrate a WordPress 3 Blog” article for instructions. When moving things around the best practice is to keep the old server/site up and running until the new one has been fully migrated and tested. That way you can be 100% sure that everything made it over.

WordPress Migration

The best way to do this is simply to change your hosts file to reflect the new IP of the server you are moving to. Simple, short, here it is.

Step 1

Find the IP address of the new server/host you are moving your site to.

Step 2

Now browse to “My Computer” and go to: C:\Windows\System32\drivers\etc. Within that folder there is a file called “hosts.” Right click on that and edit it with Notepad or Notepad++.

Hosts File

Step 3

At the end of the file, at the bottom, you can put the IP of the new server/host and then the domain you are wanting to preview. Save the file.

Host File IP

Step 4

Now in your browser, go to the domain that you are wanting to preview. It will now appear how it would once you actually change the DNS with your domain registrar. This is great for doing fresh installs of WordPress before you actually change the DNS.

READ ALSO  Add Custom CSS to your WordPress Theme

You may also like:

How to Set Featured Products in WooCommerce This is a short tutorial on how to set a featured product in WooCommerce and a shortcode you can use. Sometimes when it's too easy it is hard to fin...
Backslashes Aren’t Working in WordPress Post... Are backslashes not working in your WordPress posts? The most likely reason for this is due to a WordPress plugin. The best solution is to disable you...
Add a line break into WordPress Post or Page I don’t know why WordPress can’t seem to get line breaks to work correctly. Anyways, if you are searching for this you have probably tried adding a br...
Deleting an old Permalink in WordPress Ever had a page or post in WordPress that you wanted to name a certain name and whenever it saved, it appended it with "-2" or "-3"? Example, I was tr...
Best WordPress Plugin for Checking Broken Links &#... If you are looking for a good WordPress plugin to find and fix broken links then Broken Link Checker is one you want to check out!
  • Michael

    Any info on how to do this on a mac?

    • Shelby

      Edit the file located at /etc/hosts in the same manner. With a terminal do sudo nano /etc/hosts it will ask you for your password then you can make your edits and hit ctrl+x to exit and y to save