Migrating a WordPress site is something you may have to do at some point. Maybe you’re migrating from one hosting provider to another. Maybe you’ve created a local site or maybe you’re migrating from a Multisite installation.
In this guide, you’ll learn how to migrate a WordPress site yourself. If you’re switching to Kinsta, we’ll take care of the migration for you.
If you’re with a different host, prefer to do it manually, or you’re migrating between local and remote sites, this guide will help you.
When You Might Need to Migrate a WordPress Site
There are a few scenarios in which you might need to migrate a WordPress site. Let’s look at some of them.
- Uploading a local development site to a remotely hosted site. If you’re doing your development work locally (which is a good idea) you’ll need to migrate the site to your remote site. Later on, when you’re developing the site, you might need to migrate just files and not the database, or you might need to migrate the database in both directions so you can test any changes with current data.
- Switching between hosting providers. This is one of the most common scenarios for migrating WordPress. A good hosting provider (including Kinsta) will perform the migration for you free of charge: you just have to provide the login details for your old site. If your site has a more complex setup or you prefer to do it yourself, you can follow the methods in this post.
- Migrating a site out of a WordPress Multisite network. If you’ve been hosting a site on a Multisite network and decide you need to separate it out, then you’ll need to migrate just that site out of the network and then migrate it to a fresh WordPress installation. This is more complicated than migrating from one standalone site to another, but it can be done.
- Migrating a site into a WordPress Multisite network. Sometimes you might need to take an existing single site and migrate it into a network. Again, this is a little more complicated than migrating from one single site to another, but you can do it. It’s something I sometimes do for clients who have an existing site they want to migrate to my hosting; I prefer to use Multisite for all my client sites.
The simplest way to migrate your WordPress site is using a plugin.
Migrating a WordPress Site with the WordPress Duplicator Plugin
Let’s take a look at how you’d use it to migrate one WordPress site to another.
These instructions will work for any kind of standard WordPress installation: remote or local. It will also work if you want to migrate a complete Multisite network. I’ll cover migrating sites into and out of Multisite later.
The duplicator plugin works by creating two files:
- A zip file containing the files and database from your old site (the site you’re migrating from).
- An installer.php file.
You then upload these files to the new site and run the installer.php file. The plugin will unpack the zip file and import your data and files.
Let’s take a look at how to do it.
Before You Start the Migration with Duplicator
Before you run the migration, there are a few steps you need to take.
Clean Up Your Old Site
Take some time to clean up your old site, i.e. delete any themes or plugins you aren’t using. Update to the latest versions of WordPress, your theme and plugins. It doesn’t make sense to migrate a site that’s running code you don’t need.
Disable Caching Plugins
Caching plugins can interfere with migration, so if you’re running any of these on your old site, disable them. If you’re migrating to Kinsta, we have a list of banned plugins (including caching plugins) so make sure you aren’t running any of those.
Backup Your Old Site
Before you migrate your site, take a backup. This applies whatever your hosting environment. Use your backup plugin or your hosting provider’s dashboard to create a backup of your old site and store it somewhere safe – not on your hosting server.
Create the New Site
You’ll need to create a new, empty site (without WordPress installed) in the new location for your site.
You can then import your files into that site. Remember, don’t install WordPress.
If you’re migrating to a local site, you’ll need to install a tool such as Desktop Server so that you can run WordPress. If you’re importing to another hosting provider, you’ll need SFTP access to your /public/ directory. You don’t need to install WordPress.
Migrating a Multisite Network
If you’re migrating a Multisite network into Kinsta and that network includes subdirectories, you’ll need to contact Kinsta support and ask them to enable the necessary Nginx configuration to make this work.
If you’re migrating to or from another hosting provider, check with them if there’s anything you need them to do before you can do the migration.
You should also check the guidelines for the Duplicator plugin for additional steps you need to take for a Multisite migration. These only apply if you are moving to a different hosting provider or domain name.
Creating an Archive of Files and Data From Your Old WordPress Site
The first step in the migration process is to create the files from your old site so you can import them into your new site.
Install and activate the WordPress Duplicator plugin. Go to Plugins > Add New then search for ‘WordPress Duplicator’. Click the Install button for the plugin followed by the Activate button.
Now it’s time to create the archive file which will be used to migrate your site. Click on Duplicator in the admin menu to go to the plugin settings.
This screen shows all the packages you’ve created – which are the archives of your site. Right now, it will be empty.
To create an archive of your site, click the Create New button.
You’ll then be taken to a setup screen where you enter details of the package as follows:
- Name: Give the package a name that is meaningful to you.
- Storage: Specify where the package files will be stored. In the free version of the plugin, you can store it on your web server, in which case you’ll need to either download it later or pick it up from the email the plugin will send to you. With the pro version of the plugin, you can use third-party storage services such as Dropbox and Google Drive. Select the one you want to use and you’ll be prompted to sign in to it.
- Archive: Specify whether you want to archive only the database or the database and files too. As you’re migrating your site, you’ll need everything. Leave the checkboxes unchecked.
- Installer: in this section, enable password protection for your package by adding a password. You’re creating a file with everything from your site in it, so security is important.
Now click the Next button to continue.
The plugin will scan your system and let you know if everything is ok.
If there are any problems, follow the advice given by the plugin. As you cleaned up your site before you started, you shouldn’t have any problems.
Now click the Build button to build the archive. Wait for the process to complete and don’t click away from the screen.
When it’s done, you’ll be given the option to download your package files.
Click the One-Click Download button to download both files to your computer. Store them somewhere safe where you will be able to retrieve them for the migration into your new site.
You now have your archive.
Importing the Archive to Your New Site
The next step is to import the files to your new site and run the importer file.
Once you’ve done that, run the installer by visiting its URL in your browser. You do this using the temporary URL for your new site as you haven’t transferred your domain across.
So if your temporary URL is http://temp.kinsta.com, you would visit http://temp.kinsta.com/installer.php in your browser.
This opens the duplicator screen.
If you provided a password when you set up the duplicator file, enter that and click the Submit button.
You’ll then be taken through the process of running the import. On the next screen, check the checkbox at the bottom and click the Next button.
The plugin will then extract the archive files, which could take a while depending on the size of your site. The next step is to install a new database, which will require:
- host name.
The plugin will use this data to update the site settings.
You can find all of these in the Info screen for this site in MyKinsta.
If you are migrating to another hosting provider, ask them for the details or find it in the email they sent you when you signed up.
Click the button to check the database is working correctly, and make any corrections if you need to. Once the system is happy, click the Next button.
The Duplicator plugin will then run through Step 3, where it will use the temporary URL for your new site to make the database work correctly. Click the Next button to proceed to Step 4, from which you can log in to the site.
When you visit your site, you should now have a perfect duplicate of your old site. The only difference will be the domain name.
Redirecting the Domain Name
Once you’ve tested your new site and you’re happy it’s working as it should, you can redirect the domain name to your new site.
If you’re switching hosting providers, then you will need to update the DNS for your domain name to have it point to your new site.
With your domain registrar, change the nameservers, A or CNAME record to reflect your new location. Which of these you use will depend on your setup.
If you also need to use your domain name for things like email, then you won’t want to change the nameservers as this will point all versions of your domain name at your new hosting provider.
Once you’ve done that, you need to update the domain in your hosting admin. In MyKinsta, go to the Domains page for your site, where you can update the domain.
If you’re with another hosting provider, you’ll need to add an add-on domain to your account so that it directs to your new site. Your provider should be able to give you guidance on doing this.
You’re not quite done yet.
The final step is to update the domain in the WordPress admin screens. In your site, go to Settings > General and find the URL fields. You should only do this once the DNS have propagated and the domain is pointing to your new site.
This can take up to 48 hours but is often much quicker.
There are two fields to update:
- WordPress Address (URL): this is the address of the site itself, so the primary domain you’re using with the site.
- Site Address (URL): if you want the address users see to be different from the actual site address, just update this field. If both of them will be the same (which is normal), update both fields.
Click the Save Changes button to save the URLs.
You now have your new site operating at your new location. If you no longer need the old site, it’s time to delete that and close down your old hosting account if you switched providers.
Migrating a Site into or out of WordPress Multisite with Plugins
If you’re migrating a single site into or out of WordPress Multisite, you can do it with a plugin but you can’t use the WordPress Duplicator plugin. This is because you don’t want the entire database and files to be migrated: just those from the relevant site.
To migrate in and out of Multisite with a plugin, you’ll need to use three plugins:
- One to migrate content.
- One to migrate widget settings.
- One to migrate users.
Depending on your setup, you might not need to use all of these. Let’s see things step by step.
Migrate Files into or out of WordPress Multisite
Before you migrate any content or settings, you need to migrate the theme and plugin files. You can do this in one of two ways:
- Install the same theme and plugins in the new site via the Themes or Plugins screen or upload them to the new site if you bought them from a third-party source.
- Download the theme and plugin files from your old site using SFTP and upload them to the new site.
Both of these methods will work, but if your theme or a plugin was developed specifically for your site, you’ll need to download it from the old site and upload it to the new site. Alternatively, if you kept a backup of the files locally or using a version control system such as Github (which is a good idea), you can upload them from there.
(Suggested reading: Git vs Github: What’s the Difference and How to Get Started with Both)
If you need to upload and install themes and plugins to a site in a WordPress Multisite network, you’ll need to install them for the network and then activate them for the individual site. You can find out more about doing this in our guide to WordPress Multisite.
Can’t decide on a WordPress theme? Check out our hand-picked list of the best WordPress themes.
Activate the theme for your new site and activate any plugins too. A few things to be aware of:
- If your new site is in a Multisite network, you’ll need to enable the theme for that site by going to Network > Sites, click the Edit button below the site you’re working with and selecting the Themes tab. From there you can enable the theme. Then go to Appearance > Themes in the new site and activate the theme there.
- You don’t need to enable plugins for the individual site. Instead, you can install them, then go to the Plugins screen for that site and activate them there.
- If you’re migrating from a site in a network to a standalone site, you can just install and activate the theme and plugins as you would for any site.
You now have all your files in place on the new site. Take some time to configure the theme and plugins: you’ll have to do this manually if you’re using a plugin to do the migration.
The one configuration you don’t have to do is for widgets: you can use a plugin for that, as we’ll see shortly.
Import Users into and out of Multisite
If the site you wish to migrate has users other than yourself, you’ll need to export the users from your old site and into your new one. If you’re the only user, you can skip this step as you’ll be creating yourself as a user when you create the new site.
Importing and exporting users into and out of Multisite is complicated by the fact that WordPress doesn’t store users for each site in Multisite. Instead, it stores them all in one database table for the whole network, called wp_users.
If you’re importing from a site in a network, you should only export those users that are registered on your site, and not those registered for other sites on the network. And if you’re importing to a site in a network, you only want to activate those users on that site, not for other sites on the network.
If your site includes multiple authors, do this before importing the content so you can assign the correct user to the content when you import it to the new site. So let’s do it!
You can migrate users between sites using the Import Export WordPress Users plugin.
Start by installing and activating the plugin in both your old and new sites. Then in your old site, go to Users > User Import Export.
Select the User/Customer Export tab at the top. Select which user roles you want to export (if you leave this as the default it will export all roles), then scroll down and click the Export Users button.
The plugin will download a CSV file to your computer. Save this somewhere you’ll be able to find it again for the import.
Now in your new site, go to Users > User Import Export and select the User/Customer Import tab.
Upload the CSV file you just created and click the Upload file and import button. The plugin will upload the file and import the users to your new site.
When working on a site within a Multisite network, you do the importing and exporting in the site, not in the network admin. Any imported users will be added to the database for the whole network but they will only be activated on the one site.
Migrate Content into or out of WordPress Multisite
Start by exporting your content. Go to Tools > Export. Select All content and click the Download Export button.
Save the download file somewhere you can find it again. It will be in the XML format.
Before you import any content into the new site, it’s important to make sure you have any custom post types or taxonomies set up if you had these in the old site. If you haven’t done this, go back to the previous step and make sure you have the same theme and plugins installed and activated on the new site as you did on the old site.
Now open the new site and go to Tools > Import. Scroll down to the WordPress section. If you already have the importer plugin installed, click Run Importer. If you don’t have it installed, follow the instructions here to install and activate it, then run it.
The importer will prompt you to upload a file for import. Click Choose File, find the file you exported from the old site and click the Upload file and import button.
The importer will prompt you to assign content to the correct users in your new site, which is why it’s important to import users before you import content. If you haven’t done this yet, pause the content import and go back to the previous step.
Select the relevant users and check the Download and import file attachments checkbox. WordPress will find any attachments in your old site, grab those if it can and import them to the new site. Sometimes this doesn’t work because of security or access, but if you’re migrating from one remotely hosted site to another, it normally does.
Click the Submit button. WordPress will upload the file and create the content. When it’s done, you’ll get a notification. Head on over to your posts (click Posts in the admin menu) and you’ll see your imported posts in your new site.
You’re well on the way to having your site migrated – all that’s left now is to migrate widget settings.
Migrate Widgets into and out of Multisite
The final step is to migrate widgets. You don’t have to configure these manually: you can use the Widget Importer & Exporter plugin instead.
Start by installing and activating the plugin on both your old site and your new site.
In your old site, go to Tools > Widget Importer/Exporter. This will take you to the Widget import/export screen.
Click the Export Widgets button. This will download a file to your computer with the widget settings.
Now open your new site. Make sure you have all the same theme and plugins installed and activated as you did on your old site, as some of these may be providing the widgets you need to install.
The widget import process doesn’t import the widgets themselves. Instead, it imports the settings for widgets. It’s also important you have the same theme activated so that the widget areas are the same.
Go to Tools > Widget Importer/Exporter. This time, click the Choose file button and upload the file you just downloaded from your old site. It will have the .WIE extension.
Click the Import Widgets button. The plugin will import the widgets and give you a status screen to tell you they’ve been imported.
If there are any missing widget areas, the widgets from your old site will be imported but they will be added to the Inactive Widgets area in the Widgets admin screen.
And if you try to import a widget that isn’t available in your new site, probably because you haven’t activated a plugin, you’ll get an error message. Install and activate the plugin and run the import again, the plugin won’t duplicate those widgets you’ve already imported.
You should now have an identical duplicate of your old site at your new site. Take some time to check all the settings and configuration for the new site and make sure they’re identical to the old site (or tweak them if you want to make changes).
Then, if your old site was on a Multisite network, ask the network administrator to archive or delete it. And if your old site was a standalone site, delete it.
Migrating a WordPress Site Manually
If you’re comfortable working with SFTP and MySQL, it can be a quicker and more reliable way to migrate your site manually instead of using a plugin.
Here I’ll be focusing on migrating one standalone WordPress installation to another. In the next section, I’ll look at how this differs for WordPress Multisite networks.
Create a Fresh WordPress Installation
Start by creating your new site as an empty WordPress installation.
In MyKinsta, click on Sites in the admin menu, and then on the Add site button at the top right of the screen. You will see a dialog box asking you what kind of site you want to create.
Choose which data center you want to host your site at, then fill in the details for your site name and select Don’t install WordPress.
This is because you will migrate the WordPress files across from your old site. Leave the custom domain name blank for now, as you want to leave your domain name on your old site for now while you get the new site up and running.
Click the Add site button and a new site will be created for you.
If you aren’t with Kinsta, you can create a fresh site using your hosting provider’s admin interface: all you need to do is create a folder where the site will go, or if you don’t already have any other sites on your hosting account, you can skip this step and simply upload the files to the /public/ folder in the next step.
Export Files using SFTP
The next step is to migrate files from your old site to your new one. This will include theme files, plugins, uploads and any other files which plugins might have added to your wp-content directory.
Log into your old site via SFTP and download all of the WordPress files. If your site is in the root domain of your hosting, then that will mean downloading all files. If you installed WordPress in a subdirectory, download the contents of that directory.
To access your site, you’ll need your SFTP details. In MyKinsta, you can find those by clicking on Sites then the name of your site and choosing the Info tab.
Below you can see the files in my site as viewed in the free FileZilla FTP client.
Export the Database from Your Old Site
As well as the files, your new WordPress site will need a duplicate of the old database. To do this, you use a MySQL tool, normally phpMyAdmin.
In your hosting interface for your old site, go to phpMyAdmin.
Tired of a slow host for your WordPress site? We provide blazing fast servers and 24/7 world-class support from WordPress experts. Check out our plans
In MyKinsta, you do this by clicking on Sites, selecting your site and then going to the Info screen. In the Database access section, click the Open phpMyAdmin button.
You will be prompted for your database username and password. These aren’t the same as the password for your hosting account.
In MyKinsta, you can find the database username and password in the Database access section of the Info screen. If you’re migrating to another hosting provider, you will probably get this information when you sign up for your account or in your admin screens.
In phpMyAdmin, click on the Databases tab. This will give you a list of all the databases you’ve created on your hosting account.
Click on the name of the database which corresponds to the site you want to copy. You will then see a list of all the tables in the database.
Click the Check all checkbox below the list of tables and in the With selected: dropdown box next to that, select Export.
PhpMyAdmin will take you to a new screen. Click the Go button at the bottom of the screen.
PhpMyAdmin will export an SQL file and download it to your computer. Save it somewhere you’ll be able to find it again.
Import Files to Your New WordPress Site
The next step is to upload all of those files to your new site.
If your new site is hosted with Kinsta, you can go to MyKinsta to fetch the credentials for connecting to it via SFTP. Click on Sites in the admin menu, then the name of your site. In the Info screen, you’ll find your SFTP details.
In your FTP client, connect by providing the following details:
- Connection type: SFTP.
- Host name, Address, Server, or URL: your IPv4 address.
- Username: your SFTP Username.
- Password: your SFTP Password.
- Port: your SFTP Port.
Upload the files to the same directory they were in your old site, normally the /public/ directory.
It may take a while for them to upload so you might want to get a cup of coffee while you wait.
Import the Database Tables to Your New Site
The final step is to import the database tables.
In the hosting interface for your new site, go to phpMyAdmin. In MyKinsta, you access this via the Info screen for your site.
If you accidentally created a WordPress installation already, or you need to override an existing WordPress site, you’ll need to drop the existing database tables. Select all of the tables in the same way as you did when exporting them from your old site, and click the With selected: dropdown list. Select Drop.
You will be prompted to confirm that you want to delete the tables, and then everything in your database will be deleted. If you have any doubt that you want to do this, make a backup of the database first by exporting the tables.
Once you’ve dropped your database tables, or if you didn’t have a database in the first place, you’ll need to import the tables from your old site to your new site.
In phpMyAdmin, click the Import tab. In the File to import section, click the Choose file button and select the SQL file on your computer that you downloaded already.
Go to the bottom of the page and click the Go button. PhpMyAdmin will upload the SQL file and use it to create database tables for your new site which will be identical to the ones in the old site.
If you’re migrating a site to a local installation or to a hosting provider other than Kinsta, you will probably need to create an empty database before you can import the tables. In phpMyAdmin, you do this by going to the Databases screen and clicking the Create database button. Give the database a name that makes sense and then import the tables to that.
Edit Your wp-config.php File
Now that you have your database uploaded, you need to edit the wp-config.php file in the new site to make sure it reflects the database you’ve just created.
Go back to your FTP client and find the wp-config.php file in your new site. Make a copy of it so you have a backup (just in case). Then right-click on the file and click the Edit option to open it. Find the section that includes details of the database:
Update these lines with the credentials for your database that you’ll find in the Info screen in MyKinsta. If the site is on a local machine, use these credentials:
- Name: the name you gave the database when you created it.
- Username: root.
- Password: root.
If you’re migrating your site to a different hosting provider, you’ll need to find these credentials in your hosting dashboard.
If you skip this step, you will be prompted to provide these details when you first try to access the site.
Test Your Site and Update the Domain
Now you have your new WordPress site set up, take some time to test that it works as it should. While you are testing it, only test links that point to the new site and not the old one, as you’ll find that some of the links in the database have the old domain name.
This is ok because once you’ve tested the site, you will update the domain name.
Compare the old and new site and check that they are identical.
Redirect the Domain Name to Your New Site
Now that your new site is ready, it’s time to take the old site down and redirect your domain name to the new site.
The process for this is the same as if you use the Duplicator plugin, so follow the instructions above in that section of this post.
You now have your new site at your new location. If you no longer need the old site, it’s time to delete that and close down your old hosting account. And you’re done!
Manually Migrating a WordPress Multisite Network
If you need to manually migrate a Multisite network or to migrate a site into or out of a Multisite network, and you don’t want to use the plugins approach outlined above, you can do this.
It is complicated by the fact that you only need to migrate some of the database tables and some of the files.
Instead of describing the process in full, I’ll outline the differences so you can apply these when working through the manual migration above.
Note that if you’re migrating the entire network, the process is the same as for a single site, as it’s the entire installation you’re migrating. Here I’ll focus on migrating individual sites into and out of Multisite.
Create the New Site
As you won’t be migrating the entire network installation, you’ll need to set up a WordPress installation before you start. If you’re migrating into an existing network, you won’t need to do this as the network already exists.
When you come to migrate the files, you won’t import the WordPress files, but just the contents of the wp-content directory.
If you’re exporting from a single site into a network, the process of exporting files will be the same as above.
If you’re exporting a site that’s currently in a Multisite network, you’ll need to find just the files from that site.
Start with plugins and themes. You only need to download those plugin and theme files that are used on this specific site, not all of the plugins and themes installed on the network. Look in the admin screens for the site to find these and download them from the wp-content/themes and wp-content/plugins directories.
In a Multisite network, uploads are stored separately for each site so you just need to download the ones for the site you are exporting.
Start by finding the ID of the site, which will be a number. You can find this in the Network Admin > Sites screen in your network. Then in your wp-content directory, open the uploads/sites folder and find a folder with the site ID (the number) as its name. Download the contents of that folder.
Export the Database Tables
If you’re exporting from a site in a network, you’ll only need to export the tables that relate to that site. In phpMyAdmin, find the tables called wp-id-name, where id is the ID of the site and name is the name of each unique table. Select all of those and then click the Export option.
The example below is from a site in a network with plugins creating extra database tables for each site. You’d need to export those too.
Once you’ve done that, you’ll need to edit those table names before you can import them to a standalone site. Make a backup of the SQL file and open the original. Search for all instances of (for example) wp-3-, where 3 is the ID of the site. Replace them with wp-. Save the file and then use the recently edited file when importing to the new site.
If you’re importing to a site within a Multisite network, you’ll need to upload the uploads to the correctly numbered folder in wp-content/uploads/sites.
This means you’ll need to create a fresh site in your network first so that WordPress creates this folder. Do this following the instructions in our guide to WordPress Multisite.
When you import the theme and plugin files, upload them to the wp-content/themes and wp-content/plugins folders as you would do for a normal WordPress site.
Import Database Tables
If you’re importing to a site within a Multisite network, you’ll need to make sure the tables in the SQL file have the correct prefix before you import them.
After you create the new empty site in your network that you’ll be migrating into, make a note of the ID of that site. Make a backup of the SQL file you downloaded from the old site and open the original. In that file, replace all instances of wp- with (for example) wp-3-, where 3 is the ID of the new site. Save that file.
Next, in phpMyAdmin, select the files that have been created for the new site in your network (all the ones with the ID of the site in their prefix). Drop all of these. Once that’s done, import the new file to create new versions of those tables.
If you accidentally drop the wrong files or edit the SQL file incorrectly, it could break your Multisite network. So only do this if you are comfortable working in phpMyAdmin. And make a backup of your network first!
Because users are stored for an entire network and not for individual sites in the network, there is no manual way to export users to or from a site within a WordPress Multisite network.
The only way to do this is by using the plugin method outlined earlier in this post. Do that after you’ve imported all the other files and tables.
Note that when you import users in this way they won’t be recognized as the same user when it comes to attributing posts to authors. You’ll need to go through all of the posts/pages and manually attribute them to the correct authors.
Migrating a WordPress site between hosts or from local to remote installations is something that many WordPress users have to do at some point. There are a number of ways you can do it and the main distinction is whether you do it manually or using a plugin.
If you move to Kinsta, we’ll be happy to take care of migrating your site for you.
On the other hand, if you decide to migrate a WordPress site yourself, the steps outlined above will help you do it reliably and make sure your new WordPress site is identical to your old one.
If you enjoyed this article, then you’ll love Kinsta’s WordPress hosting platform. Turbocharge your website and get 24/7 support from our veteran WordPress team. Our Google Cloud powered infrastructure focuses on auto-scaling, performance, and security. Let us show you the Kinsta difference! Check out our plans