Monday, March 30, 2020

How to Migrate a WordPress Site

How to Migrate a WordPress Site
Final product image
What You'll Be Creating

If you’re switching hosting providers or you’ve been developing a WordPress site locally and you need to make it live, you’ll be wondering how to move your site.

For a WordPress site, migration is a little more complicated than for a static site, because WordPress consists of a few components. But it is possible.

In this tutorial, I’ll show you how to migrate a WordPress site to a new hosting provider or from a development site to a live site. I’ll show you how to do it on SiteGround, our recommended hosting provider, and how to do it manually if you’re with a different hosting provider. 

SiteGround makes it easy to manage your WordPress sites, and have a lot of tools for safe and speedy migration. Thanks to Envato's partnership with SiteGround, you can get up to 70% off managed WordPress hosting.

Times You Might Want to Move Your WordPress Site

There are a few scenarios in which you might want to move your WordPress site:

  • You’re switching hosting providers and want to move it to your new server.
  • You’re staying with your existing provider but want to move it to a new domain name.
  • You want to move it from a subdirectory of your site to the main root domain.
  • You’ve got a staging site and want to migrate changes you’ve made to that to your live site.
  • You’ve been developing a new site on your local machine and want to migrate that to your live site.

In some of these cases you’ll need to physically move your site, but in others you won’t. Let’s take a quick look at the situations in which you don’t actually have to move your site.

When You Don't Actually Need to Migrate Your WordPress Site

Out of the scenarios above, there are two which don't mean you need to physically move your site from one place to another. These are:

  • You’re staying with your existing provider but want to move it to a new domain name.
  • You want to move it from a subdirectory of your site to the main root domain.

If you want to change the domain name of your site, you don’t have to move it unless you’re switching hosting providers. WordPress lets you change the domain name of your site while keeping your site exactly where it is. To find out how to do this, follow our upcoming guide to changing your WordPress domain name.

If you want to move your site from a subdirectory into the root domain, you also don’t need to physically move anything. All you need to do is tell WordPress what to use as the site’s domain, and where to find the files. Follow our guide to moving WordPress from a subdirectory into the root directory to do it.

Another scenario in which you don’t need to completely move your site is when you have a staging site.

Some SiteGround hosting plans include staging servers, and when you want to push your staging changes to your live site, you don’t need to migrate the whole site across. Simply use the tools in your SiteGround admin to push your staging changes to live, and it will be done for you.

So that leaves us with two scenarios in which you really will need to move your site. These are:

  • You’re switching hosting providers and want to move it to your new server.
  • You’ve been developing a new site on your local machine and want to migrate that to your live site.

So let’s take a look at how you would migrate your site in both cases.

Moving Your WordPress Site to a New Hosting Provider

When you move to a new hosting provider, your first option is to get your provider to do it for you. GrowBig and higher plans at SiteGround come with one free website transfer. All you need to do is provide the login credentials for your old site, and they will handle it for you.

This saves you the time and hassle of moving your site yourself and means you don’t have to learn it.

Alternatively with SiteGround you can use their WordPress Migrator. This is a plugin you install on your old site which handles the migration process for you.

But if your hosting provider doesn’t offer this, or if you want to make changes to the way the site is configured during the migration and would rather do it yourself (or if you simply want to learn how migration works), you have the option to do the site migration yourself.

If this is the case, you have two options:

  • Migrate the site using export and import plugins.
  • Migrate the site manually by migrating the database and files as well as installing a new instance of WordPress.

I’ll take a look at each of these methods in more detail shortly. But first, what if you’re migrating from a local site?

Migrating a Local Development Site to Live

If you’re migrating a local site and making it live, you don’t have the option of asking your hosting provider to do it for you, as they don’t have access to your local machine. However you can do it yourself, using one of the same three methods:

  • Migrate the site using export and import plugins.
  • Migrate the site manually.
  • Use the SiteGround Migrator tool to migrate your site into SiteGround.

If you’re with SiteGround, the migrator tool makes it much easier to migrate your development site to live which means your site will go live quicker. I’ll show you how to use it shortly. But first, let’s take a look at the other two options.

Migrating Your WordPress Site Using Plugins

If you don’t want to manually migrate the database and files and you don’t have access to a migrator tool, one way to migrate your site is to use plugins.

WordPress Export tool

The steps are:

  1. Install the same themes and plugins in your new site as were on your old site. You must do this first or the import process won’t work.
  2. Use the WordPress Export tool (Tools > Export) and Import tool (Tools > Import) to export content from your old site and import it to your new site.
  3. Use the Widget Import/Export plugin to export widget settings from your old site and import them to your new site. This is much quicker than doing it manually if you have lots of widgets.
  4. Manually configure the settings fro your new site so they are the same as your old site. You’ll need to do this via the Settings section of the WordPress admin.

This method isn’t perfect—it involves some manual configuration. But it’s a good option if you don’t want to start messing with the database.

Migrating Your WordPress Site Manually

The next option is to migrate your site manually. This consists of:

  1. Installing WordPress at the new hosting provider.
  2. Copying all of the theme and plugin files from the old site to the new one using FTP.
  3. Dropping all the database tables from the new site, using phpMyAdmin.
  4. Exporting the database tables from the old site using phpMyAdmin.
  5. Importing the database tables to the new site using phpMyAdmin. You’ll need to edit the SQL file that holds this data before you upload the tables if your new site is on a different domain to your old site.

This option gives you the most control but is the most complicated and the most risky if you aren’t familiar with using phpMyAdmin or working with the database. You can see how to do it in detail in our guide to migrating WordPress manually.


Using the SiteGround Migrator to Migrate Your Site

If you’re migrating your site to SiteGround, you have a much easier option which is just as thorough as doing it manually, and that’s using the SiteGround migrator tool. Let’s work through the process of using the migrator to migrate a site into a SiteGround hosting account.

Generating a Migration Token

Log into SiteGround and click the Websites option.

websites screen in SiteGround

Click on Site Tools for your site, and then on WordPress > Migrator in the admin menu.

WordPress migrator screen in SiteGround

Here you’ll need to generate a migration token to start the process.

If you want to migrate your site to the root URL of your site, leave the Path field blank. But if you want to create a new site in a subdirectory of your site, add the name of the new subdirectory here. I’m going to use a subdirectory for the purposes of this demonstration, but it’s likely you’ll want to migrate to the root directory.

Generate Migration Token

Note: the folder where you want to migrate to should be empty. Don’t install WordPress there before you start. If you’ve already done that, delete that WordPress installation.

Now click the Generate button to generate the token.

You’ll see your token on screen. Copy it and click the Download Plugin button. You’ll be taken to the WordPress page for the plugin. You can either download it from here and upload it to your old site manually, or you can install the plugin via the Plugins admin screens and the plugin dirtectory.

Installing the Migrator Plugin in Your Old Site

Next, go to your old WordPress site and install the plugin. 

Here’s the home page of my old site. It’s a store with WooCommerce installed and some dummy products added. The migration process will copy all of that across.

old site home page

Go to Plugins > Add New. Here, you can either upload the file you downloaded from SiteGround by clicking the Upload Plugin button, or you can search for the SiteGround Migrator plugin. I’m going to use the second option.

In the search box, type SiteGround Migrator. The plugin will be displayed.

SiteGround migrator in Plugins screen

Click the Install Now button. WordPress will install the plugin and then that button will change to an Activate button. Click it again to activate the plugin.

Migrating Your Site with the Plugin

Now in the admin menu on the left, you’ll see a SG Migrator link. Click on that to go to the plugin screen.

SiteGround migrator plugin screen

Go back to the SiteGround migration screen in your SiteGround account and copy the migration token (if you haven’t already copied it). If it’s not still on the screen, you can find it by scrolling down to see all the tokens you’ve generated.

migration tokens

Paste that into the Migration Token field in your old site and click the Initiate Transfer button.

If your new site is on a different domain from your old site, you’ll see a warning (you won’t see this if you’re using the same domain for both).

new domain warning

SiteGround will change the domain name in your database updating it to your new domain. If you’re happy with this, click the Continue button. 

If you want to use the same domain for your new and old sites and you get this message, you’ll need to change the settings in your new SiteGround account and use your domain there. You don’t need to have your domain actually pointing to your new account yet as SiteGround gives you a temporary URL for testing your new site before you switch the DNS over. For guidance on this, see the SiteGround documentation on DNS.

If you want to update your domain name settings in your new hosting account first, click the Cancel Transfer button and update your domain name, then come back and continue the transfer process.

The migrator will then start the process and update you on it via the plugin screen.

migration progress

When the migration is complete, you will see a success screen.

migration success screen

To access your new site on the temporary URL, click the Go to Site button. As you can see in the screenshot, my new site is exactly the same as my old one, and everything has migrated across.

new site home page

Updating DNS Settings

Once you’re happy with the new site, you’ll need to update your DNS to point your domain name at your new site.

If your domain is registered with SiteGround, this will already be done for you, but if your domain is registered elsewhere, you’ll need to update the nameservers with your domain registrar. You’ll see the name servers on the success screen in the plugin. You can also access them in your SiteGround account by going to Site Tools > Dashboard where you will see your nameservers in the Name Servers section of the screen.

nameservers in the SiteGround dashboard

Summary

Migrating your WordPress site can be easier than you think. If you’re migrating to a SiteGround account, the migration tool makes it possible to migrate your site quickly, without having to manually copy any files or access the database.

And if you can’t use a tool like this, you can either migrate your site using plugins or migrate the database and files manually. These will take a little more time and care but are perfectly possible.

Special Discount for WordPress Hosting From SiteGround

If you are switching WordPress providers, take a look at SiteGround. It comes with an easy installer, free support, and automatic updates. And as mentioned, a lot of support for migrating your site! We're happy to be able to offer a huge discount of 70% off self-managed WordPress hosting, thanks to our partnership with SiteGround.

Managed WordPress Hosting From SiteGround

No comments:

Post a Comment