In the last article, we saw how to perform the first three steps of WordPress migration to a new host – environment preparation, cloning the database on the destination server, and moving all of your files over. However, it’s important to fully test things out before you make the final switch. Especially if you are a highly trafficked site, you don’t want to risk of any problems occurring when your visitors check things out. But without changing your DNS settings, people will continue to view your site on the old server. How do we perform a dry run? And how do we make the DNS switch at the end? This article will take a look at the final touches of changing your web host.

Accessing your Site via a Temp URL

Every web host allows you to access your site via a “temporary URL”. This is useful when you either haven’t yet changed your DNS settings, or you’re waiting for the changes to propagate. Some hosts like SiteGround make it incredibly easy to access your site directly via the temporary URL. For example when you log into your SiteGround account, you can see the option called “Access Site by IP” as shown here:

access site by IP

This immediately takes you to the “public_html” folder. Before you move your files and databases, it would’ve been empty and you may not have seen anything at all. But if you’ve done the previous steps correctly and your files and databases are working properly, you should be able to access the homepage of your site – but with a “404” error as shown below:

404 for home page

This occurs because while you’ve migrated your WordPress site to a new server, the destination doesn’t have the same URL as the original and your WordPress installation hasn’t been informed that this is a temporary situation. Before making the move, if you access your WordPress administration dashboard and go to the “General” menu item under “Settings”, you will see the following two fields specifying the blog homepage and location:

settings that need to be changed

The settings will remain the same even in your destination server since you’ve blindly copied all the files and databases. What we need to do is to change these to match our temporary URL – at least for the time being as long as testing is in progress. But how do we do it? After all, our WordPress dashboard is out of bounds as well due to the same reason. There are actually two ways to go about it:

  1. Make the changes in the database, or
  2. Add a couple of settings in the wp-config.php file

I personally prefer the latter option since something makes me uneasy about fiddling around with databases. So using your file Explorer from the cPanel dashboard (which you should be very comfortable with by now), navigate to your blog’s wp-config.php file, right-click it, and enter the code editor.

change wp-config

Over here, add the following to settings as shown above making sure to change the temporary URL to match your own, and using that as the base for your blog address. I keep mine in a subfolder, but most people don’t so you’ll probably just need to use the temporary URL by itself without adding anything else after it.

define('WP_HOME','http://181.224.143.225/~bhagwad0/blog/');
define('WP_SITEURL','http://181.224.143.225/~bhagwad0/blog/');

Save the wp-config.php file and access your site again. Voilà! You can now test your site homepage as well as all the other parts of it including the administration dashboard. This is the time to ensure that everything is working properly, the correct plug-ins are enabled, the images are loading properly etc. Remember – what you see now is exactly what you’re visitors will experience when you finally make the DNS changes.

Once you’re satisfied, it’s time to take the plunge. First reverse the above changes by deleleting these two lines in wp-config.php. Now for The DNS switch!

Changing the DNS Settings

This is actually the easiest (and last) part of the WordPress migration process. First of all, you need to get the details of your new DNS servers from your hosting account. These will usually be specified in the welcome email, or in the cPanel administration dashboard itself as shown here for SiteGround:

new nameservers

Now navigate to your domain registrar and access the DNS settings page. For this example, I’m using Godaddy. Click on the “Manage DNS” link (or whatever it’s called) and make the changes:

change nameservers

You’re done. Take a deep breath, pat yourself on the back, and wait for the changes to propagate. You can keep checking the status of the DNS propagation by visiting this website. Flush your DNS cache from your web browser and ping your site using the commandline to check and see whether it’s resolving to the new IP address. Then access the homepage and make sure that all is working properly. If at any time you need to go back, simply reverse the DNS changes in the last step and your site visitors will once again revert to your old working WordPress installation.

And that’s how you migrate WordPress from one server to another!

tracking pixel

Is your website slow?

Enter its URL below to find out now:

About the Author

Bhagwad Park

3 Comments on “Migrating WordPress from BlueHost to SiteGround – Part 2”

  1. I’ve followed your great instructions to the point where I access the site using the the temporary URL which has been added to the wp-config.php file. The home page looks great, but all of the other pages give a 404 error. Is this related to the use of “pretty” permalinks on the original site?

    • Try deleting the .htaccess file and let WordPress recreate it. Also, disable and enable the permalinks from the dashboard. That should reset it. Along with the wp-config.php changes, let me know if that works!

      • Thank you very much for replying. It worked! All I had to do was set the permalinks to the default form, which I assume is what you meant by turning them off. Thanks for helping out with transferring our site, friendsofthelegacytrail.org. If you get over to this side of Florida I recommend our trail for a nice bike ride.
        Thanks again,
        Steve

Leave a Reply

Your email address will not be published. Required fields are marked *