Moving the WordPress website is something you may need to do at some point. Maybe you want to move the WordPress site to a new host. Maybe you have created a local site, or you are installing a migration from multiple sites.
In this guide, you will learn how to migrate WordPress sites to another server yourself.
If you are using a different host, prefer to do it manually, or if you are migrating between local and remote sites, this guide will help you understand how to move your WordPress site to a new host.
- When you may need to migrate WordPress sites
- How to use the WordPress Duplicator plug-in to move a WordPress site to a new host
- Use plug-ins to migrate sites to or from WordPress multi-site
- Manual relocation of WordPress site
- Manual relocation of WordPress multi-site network
When you may need to migrate WordPress sites
In some cases, you may need to migrate WordPress sites. Let’s take a look at some of them.
- Upload the local development site to the remote hosting site. If you are developing locally (which is a good idea), you need to migrate the site to a remote site. Later, when you develop your site, you may only need to migrate the files instead of the database, or you may need to migrate the database in both directions so that you can test any changes with the current data.
- Switch between managed service providers. This is one of the most common scenarios for migrating WordPress. Moving a WordPress site to a new host is usually quite simple. A good WordPress hosting provider will perform the migration for you free of charge: you only need to provide login details for the old site. If your site has more complex settings, or if you prefer to do it yourself, you can follow the methods in this article.
- Migrate the site out of the WordPress multisite network. If you have been hosting a site on a multi-site network and decide that you need to separate it, you just need to migrate the site off the network and then migrate it to a new WordPress installation. This is more complex than moving from one stand-alone site to another, but it can be done.
- Migrate the site to the WordPress multisite network. Sometimes you may need to use an existing single site and migrate it to the network. Again, this is a little more complicated than moving from one site to another, but you can do it. I sometimes do this for customers of existing sites that want to migrate to my host; I prefer to use Multisite for all my customer sites.
The easiest way to migrate a WordPress site is to use plug-ins.
How to use the WordPress Duplicator plug-in to move a WordPress site to a new host
The free WordPress Duplicator plug-in is our recommended plug-in for migrating the site’s WordPress to other hosts. You can install it on your website through the plug-in screen, and it’s free.
Let’s see how to use the replicator plug-in to move the WordPress site to a new host.
These instructions apply to any type of standard WordPress installation and allow you to move WordPress sites from one host to another: remote or local. It can also work if you want to migrate a complete multi-site network. I’ll talk about migrating sites to and from multiple sites later.
The replicator plug-in works by creating two files:
- A zip file that contains files and databases from the old site (the site from which you want to migrate).
- An installer.php file.
Then upload these files to the new site and run the installer.php file. The plug-in will extract the zip file and import your data and files.
Let’s see how to do this.
Before using Duplicator to start the migration
There are several steps you need to perform before running the migration.
Clean up the old website
Take some time to clean up your old site, that is, remove any themes or plug-ins you don’t use. Update to the latest version of WordPress, your theme, and plug-ins. It doesn’t make sense to migrate sites that run code you don’t need.
Disable the cache plug-in
Caching plug-ins can interfere with the migration, so if you are running any of these plug-ins on the old site, disable them.
Back up your old website
Back up your WordPress site before moving it from one host to another, which applies to any managed environment. Use your backup plug-in or managed service provider’s dashboard to create a backup of the old site and store it in a safe place-not on your managed server.
Create a new site
You need to create a new empty site for your site in the new location (WordPress is not installed).
If you want to migrate to a host managed using the pagoda panel, you can create a website on the pagoda panel in a few minutes.
Add a site in the pagoda panel
You can then import the file into the site. Remember, do not install WordPress.
If you are migrating to a local site, you need to install tools such as Desktop Server to run WordPress. If you are importing to another managed service provider, you need SFTP to access your / public/ directory. You do not need to install WordPress.
Migrate a multisite network
If you are migrating a multisite network to another managed service provider or from another managed service provider, confirm with them if you need them to do anything before you can migrate.
You should also review the guide for the Duplicator plug-in to learn about the other steps you need to take for multisite migration. These only apply if you want to migrate to a different managed service provider or domain name.
Create files and data archives from your old WordPress website
The first step in the migration process is to create files from the old site so that they can be imported into the new site.
Install and activate the WordPress Duplicator plug-in. Go to plug-ins & gt; install plug-ins and search for “WordPress Duplicator”. Click the plug-in install button, and then click the enable button.
Install the WordPress Duplicator plug-in
Now is the time to create an archive file that will be used to migrate your site. Click Duplicator on the administration menu to go to the plug-in settings.
Duplicator Settin
This screen shows all the packages you have created-they are files for your site. Now, it will be empty.
To create an archive for your site, click the Create New button.
You will then be taken to the settings screen, where you can enter package details, as shown below:
- Name: give the bag a name that means something to you.
- Storage: specifies the location where the package files are stored. In the free version of the plug-in, you can store it on your web server, in which case you need to download it later or get it from an email sent to you by the plug-in. With the professional version of the plug-in, you can use third-party storage services such as Dropbox and Google Drive. Select the one you want to use and you will be prompted to log in.
- Archive: specify whether to archive only the database or both the database and files. When you migrate your site, you will need everything. Do not select the check box.
- Installer: in this section, enable password protection for your package by adding a password. You are creating a file that contains everything in your site, so security is important.
Password protection
Now click the Next button to continue.
The plug-in will scan your system and let you know if everything is all right.
Package scanning
If you have any questions, follow the advice given by the plug-in. When you clean up your website before you start, you should not have any problems.
Now click the “Build” button to build the archive. Wait for the process to complete and do not click to leave the screen.
When you are finished, you can choose to download the package file.
Download your bag
Click the One-Click Download button to download these two files to your computer. Store them in a secure place so that you can retrieve them for migration to the new site.
You have your file now.
Import files into your new site
The next step is to import the file into the new site and run the importer file.
Use SFTP to upload these two files to the / public/ directory of your new site. Using your FTP client, upload the two files to the folder (learn the difference between FTP and SFTP).
Replicator files in the new site
When finished, run the installer by accessing its URL in the browser. You can do this using the temporary URL of the new site because you have not moved your domain.
Therefore, if your temporary URL is http://temp.yourdomain.com, you will access http://temp.yourdomain.com/installer.php in your browser.
This opens the duplicator screen.
Duplicator password prompt
If you provided a password when setting up the replicator file, enter the password and click the Submit button.
You will then complete the process of running the import. On the next screen, select the check box at the bottom, and then click the Next button.
Duplicator Import proc
The plug-in will then extract the archive file, which may take a while, depending on the size of your site. The next step is to install a new database, which will require:
- Hostname.
- Password.
- User name.
The plug-in will use this data to update site settings.
You can find the details of the site in the administrative background of the server provider.
Create a database in duplicator
Click the button to check that the database is working properly and make any corrections as needed. When the system is satisfied, click the “Next” button.
The Duplicator plug-in will then run step 3, where it will use the temporary URL of the new site to make the database work properly. Click the “Next” button to continue to step 4, from which you can log in to the site.
When you visit your website, you should now have a perfect copy of the old website. The only difference is the domain name.
Redirect domain name
Once you have tested your new site and you are happy that it works, you can redirect the domain name to your new site.
If you are changing your managed service provider, you need to update the DNS of the domain name to point it to your new site.
Through your domain name registrar, change the name server, A, or CNAME record to reflect your new location. Which one you use will depend on your settings.
If you also need to use your domain name for purposes such as e-mail, you will not want to change the name server because this will point all your versions of the domain name to your new managed service provider.
When you are done, you need to add an additional domain to your account so that it points to your new site. Your provider should be able to provide you with guidance on doing this.
You haven’t finished yet.
The final step is to update the domain in the WordPress administration screen. In your site, go to Settings & gt; General and locate the URL field. You should do this only if the DNS propagates and the domain points to your new site.
This can take as long as 48 hours, but it is usually much faster.
WordPress URL Settings
There are two fields to update:
- WordPress address (URL): this is the address of the site itself, so it is the primary domain you use in the site.
- Site address (URL): if you want users to see an address that is different from the actual site address, simply update this field. If they are all the same (which is normal), update both fields.
Click the Save changes button to save the URL.
Your new site is now running in your new location. If you no longer need the old website, it is time to delete it and close your old hosting account when you change the provider.
Use plug-ins to migrate sites to or from WordPress multi-site
If you are migrating a single site to WordPress Multisite or from WordPress Multisite, you can use the plug-in to do this, but not the WordPress Duplicator plug-in. This is because you do not want to migrate entire databases and files: only those from related sites.
To migrate to and from multiple sites using plug-ins, you need to use three plug-ins:
- The first is to migrate the content.
- A migration widget setting.
- One is to migrate users.
Depending on your settings, you may not need to use all of these. Let’s look at things step by step.
Migrate files to or from WordPress multisite
You need to migrate theme and plug-in files before migrating any content or settings. You can do this in one of two ways:
- Install the same themes and plug-ins in the new site through the theme or plug-in screen, or if you purchase them from a third-party source, upload them to the new site.
- Use SFTP to download theme and plug-in files from the old site and upload them to the new site.
Both methods are fine, but if your theme or plug-in is developed specifically for your site, you need to download it from the old site and upload it to the new site. Or, if you save file backups locally or use a version control system such as Github (which is a good idea), you can upload them from there.
If you need to upload and install themes and plug-ins to sites in the WordPress multisite network, you need to install them for the network, and then activate them for a single site. You can find more information about doing this in our WordPress Multisite guide.
Activate the theme of the new site and activate any plug-ins. A few points to pay attention to:
- If your new site is on a multi-site network and you need to enable the theme for that site by going to Network & gt; Sites, click the Edit button under the site you are using and select the Themes tab. From there you can enable themes. Then go to the appearance in the new site & the gt; theme and activate the theme there.
- You do not need to enable plug-ins for a single site. Instead, you can install them and go to the site’sPlug-inScreens and activate them there.
- If you are migrating from a site in your network to a stand-alone site, you can install and activate themes and plug-ins as you would any site.
All your files are now on the new site. Take some time to configure themes and plug-ins: if you use plug-ins for migration, you must do this manually.
One configuration you don’t have to do is a gadget: you can use plug-ins for this, which we’ll see soon.
Import and export users to multiple sites
If the site you are migrating has users other than yourself, you need to export users from the old site to the new site. If you are the only user, you can skip this step because you will create yourself as a user when you create a new site.
Because WordPress does not store users for each site in Multisite, importing and exporting users to and from Multisite is complex. Instead, it stores them all in a database table for the entire network, called wp_users.
If you import from sites on the network, you should export only those users who register on your site, not those who register on other sites on the network. If you are importing sites on the network, you only want to activate those users on that site, not other sites on the network.
If your site contains multiple authors, do this before importing the content so that the correct users are assigned to the content when it is imported into the new site. So let’s get started!
You can use the Import Export WordPress Users plug-in to migrate users between sites.
First install and activate plug-ins in your old and new sites. Then in your old site, go to Users & gt; User Import Export.
User Import and Export Settings
Select the User/Customer Export tab at the top. Select the 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 plug-in downloads the CSV file to your computer. Save it somewhere and you will be able to find it again for import.
Now in your new site, go to Users & gt; User Import Export and select the User/Customer Import tab.
User / customer Import
Upload the CSV file you just created, and then click the Upload file and import button. The plug-in will upload the file and import the user into your new site.
When you work on a site in a multi-site network, you import and export in the site, not in the network administrator. Any imported users will be added to the database of the entire network, but they will only be activated on one site.
Move content into or out of WordPress Multisite
Export your content first. Go to Tools & gt; Export. Select All content and click the Download Export button.
Export from multiple sit
Save the download file where you can find it again. It will be in XML format.
Before importing any content into a new site, if you have it in your old site, make sure that you have set up any custom article types or taxonomies. If you have not already done so, go back to the previous step and make sure that you have installed and activated the same themes and plug-ins on the new site as on the old site.
Now open the new site and go to Tools & gt; Import. Scroll down to the WordPress section. If you have installed the importer plug-in, click Run Importer. If you do not install it, follow the instructions here to install and activate it, and then run it.
WordPress importer
The importer will prompt you to upload the file for import. Click Choose File, locate the file you exported from the old site, and then click the Upload file and import button.
The importer prompts you to assign content to the correct users in the new site, which is why it is important to import users before importing content. If you have not already done so, pause the content import and return to the previous step.
Import in WordPress
Select the relevant user and select the Download and import file attachments check box. WordPress will find any attachments in your old site and, if possible, grab them and import them into the new site. Sometimes this doesn’t work for security or access reasons, but it usually works if you migrate from one remotely managed site to another.
Click the Submit button. WordPress will upload the file and create the content. When you are finished, you will be notified. Go to your article (click the article in the administration menu), and you will see the imported article in the new site.
You are successfully migrating your website-all that is left is to migrate the widget settings.
Migrate widgets to and from multiple sites
The final step is to migrate the widget. You don’t have to configure these manually: you can use the Widget Importer & Exporter plug-in instead.
First install and activate the plug-in on the old site and the new site.
In your old site, go to Tools & gt; Widget Importer/Exporter. This will take you to the Widget import/export screen.
Import export gadget screen
Click the Export Widgets button. This will use the widget settings to download the file to your computer.
Now open your new site. Make sure you install and activate all the same themes and plug-ins as on the old site, as some of them may provide the widgets you need to install.
The widget import process does not import the widget itself. Instead, it imports the settings of the widget. It is also important to activate the same theme so that the widget areas are the same.
Go to Tools & gt; Widget Importer/Exporter. This time, click the Choose file button and upload the file you just downloaded from the old site. It will have a .WIE extension.
Click the Import Widgets button. The plug-in will import widgets and provide you with a status screen that tells you that they have been imported.
Widget import results
If any widget zones are missing, widgets from the old site will be imported, but they will be added to the Inactive Widgets area in the widget management screen.
If you try to import widgets that are not available in the new site, probably because you have not activated the plug-in, you will receive an error message. Install and activate the plug-in and run the import again, and the plug-in does not copy the widgets that you have imported.
You should now have the same copy as the old site on the new site. Take the time to check all the settings and configurations of the new site and make sure they are the same as the old site (you can also adjust them if you want to make changes).
Then, if your old site is on a multi-site network, ask your network administrator to archive or delete it. If your old site is a stand-alone site, delete it.
Manual relocation of WordPress site
If you are satisfied with using SFTP and MySQL, manually migrating the site instead of using plug-ins may be a faster and more reliable approach.
Here, I will focus on migrating one stand-alone WordPress installation to another. In the next section, I’ll see how this is different from WordPress multi-site networks.
Create a new WordPress installation
First create your new site as an empty WordPress installation.
In the pagoda panel, you can quickly add websites and install WordPress (it is recommended that beginners use the pagoda panel to manage the server).
Create a new WordPress site using the pagoda panel
Select the data center in which you want to host your site, then fill in the details of your site name and choose not to install WordPress.
This is because you will migrate WordPress files from the old site. Leave the custom domain name blank for the time being, because you want to leave the domain name on the old site temporarily when the new site is up and running.
Click the Add site button and a new site will be created for you.
Export files using SFTP
The next step is to migrate the files from the old site to the new site. This will include theme files, plug-ins, uploads, and any other files that plug-ins may add to your wp-content directory.
Log in to your old site through SFTP and download all WordPress files. If your site is in the root domain of the host, it means downloading all files. If you install WordPress in a subdirectory, download the contents of that directory.
To access your website, you need SFTP details, which can be obtained from your server provider’s website.
You can see the files on my website below, just as you did in the free FileZilla FTP client.
WordPress file in FTP client
Export a database from an old site
In addition to files, your new WordPress site needs a copy of the old database. To do this, you use the MySQL tool, usually phpMyAdmin.
In the hosting interface of the old site, go to phpMyAdmin.
Take the pagoda panel as an example, enter the pagoda control panel, click “Database” on the left, and click “phpMyAdmin” on the page:
You will be prompted for a database user name and password. These are different from the passwords of your host account.
In phpMyAdmin, click the Database tab. This will provide you with a list of all the databases you have created on the host account.
Database in phpMyAdmin
Click the database name corresponding to the site you want to replicate. Then you will see a list of all the tables in the database.
Database table
Click the Check all check box below the table list, and then select Export in the With selected: drop-down box next to it.
PhpMyAdmin will take you to a new screen. Click the start button at the bottom of the screen.
Export tables from the database
PhpMyAdmin will export a SQL file and download it to your computer. Save it where you can find it again.
Import files into your new WordPress site
The next step is to upload all these files to your new site.
In your FTP client, connect by providing the following details:
- Connection type: SFTP.
- Hostname, address, server, or URL: your IPv4 address.
- User name: your SFTP user name.
- Password: your SFTP password.
- Port: your SFTP port.
Upload the files to the same directory they were in the old site, usually the / public/ directory.
It may take a while for them to upload, so you may want to have a cup of coffee while waiting.
Import database tables into your new site
The final step is to import the database tables.
In the hosting interface of the new site, go to phpMyAdmin.
If you accidentally create a WordPress installation, or if you need to overwrite an existing WordPress site, you need to delete the existing database tables. Select all tables in the same way as when you exported them from the old site, and then click the With selected: drop-down list to select Delete.
Delete database table
You will be prompted to confirm that you want to delete the table, and then everything in the database will be deleted. If you have any questions about doing this, back up the database by exporting the table first.
After you delete the database table, or if you do not have a database at first, you need to import the table from the old site to the new site.
In phpMyAdmin, click the Import tab. In the “File to import” section, click the “Choose file” button and select the SQL file that you downloaded on your computer.
Upload database table
Go to the bottom of the page and click the Go button. PhpMyAdmin will upload the SQL file and use it to create the same database tables for your new site as in the old site.
Edit your wp-config.php file
Now that you have uploaded the database, you need to edit the wp-config.php file in the new site to make sure it reflects the database you just created.
Return to your FTP client and find the wp-config.php file in your new site. Make a copy so that you can have a backup (just in case). Then right-click the file and click the “Edit” option to open it. Locate the section that contains the database details:
Wp-config.php database details
If the site is on the local computer, use the following credentials:
- Name: the name you gave to the database when you created it.
- User name: root.
- Password: root.
If you are migrating your site to another managed service provider, you need to find these credentials in the managed dashboard.
Test your site and update the domain
Now that you have set up your new WordPress site, it will take some time to test whether it works properly. When testing, test only the links to the new site, not the old site, because you will find that some links in the database have old domain names.
This doesn’t matter, because once you test the site, you will update the domain name.
Compare new and old sites and check to see if they are the same.
Redirect the domain name to your new site
Now that your new site is ready, it’s time to close the old site and redirect your domain name to the new site.
This process is the same as using the Duplicator plug-in, so follow the instructions above in this section of this article.
You now have a new site in your new location. If you no longer need the old site, it’s time to delete it and close your old host account. You finished!
Manual relocation of WordPress multi-site network
You can do this if you need to manually migrate a multisite network or migrate a site to or from a multisite network, and you do not want to use the plug-in method described above.
This is complicated because you only need to migrate some database tables and some files.
I will not describe the process in its entirety, but will outline the differences so that you can apply them when performing the above manual migration.
Note that if you are migrating an entire network, the process is the same as for a single site because it is the entire installation that you want to migrate. Here, I will focus on migrating a single site to and from Multisite.
Create a new site
Since you will not migrate the entire network installation, you need to set up the WordPress installation before you begin. If you are migrating to an existing network, you do not need to do so because the network already exists.
When you migrate a file, you do not import the WordPress file, only the contents of the wp-content directory.
Export Fil
If you export to the network from a single site, the process of exporting the file will be the same as above.
If you want to export a site that is currently in a multi-site network, you only need to find the files in that site.
Start with plug-ins and themes. You only need to download those plug-ins and theme files that are used on this particular site, not all the plug-ins and themes installed on the network. Find these in the site’s administration screen and download them from the wp-content/themes and wp-content/plugins directories.
In a multi-site network, the uploaded files for each site are stored separately, so you only need to download the files for the site you want to export.
Files in a multi-site network
First look up the ID of the site, which will be a number. You can find it on the network’s Network Administrator & gt; site screen. Then in your wp-content directory, open the uploads/sites folder and find a folder with the name of the site ID (number). Download the contents of this folder.
Export database tables
If you export from a site on your network, you only need to export the tables associated with that site. In phpMyAdmin, find a table named wp-id-name, where id is the ID,name of the site and the name of each unique table. Select all of these, and then click the Export option.
The following example comes from a site in the network that has a plug-in to create additional database tables for each site. You need to export these, too.
Additional database tables in multiple sites
After you do this, you need to edit these table names before you can import them into a stand-alone site. Back up the SQL file and open the original file. Search for (for example) all instances of wp-3-, where 3 is the ID of the site. Replace them with wp-. Save the file, and then use the most recently edited file when importing the new site.
Import Fil
If you are importing to a site in a multi-site network, you need to upload it to the correct numbered folder in wp-content/uploads/sites.
This means that you need to first create a new site on the network so that WordPress can create this folder. Follow the instructions in our WordPress Multisite guide.
When you import theme and plug-in files, upload them to the wp-content/themes and wp-content/plugins folders, just as you do for regular WordPress sites.
Import database tables
If you are importing sites from a multisite network, you need to ensure that the tables in the SQL file have the correct prefix before importing.
After you create a new empty site in the network to which you are migrating, make a note of the ID for that site. Back up the SQL file downloaded from the old site and open the original file. In this file, replace all instances of wp- with (for example) wp-3-, where 3 is the ID of the new site. Save the file.
Next, in phpMyAdmin, select the files created for new sites on the network (all files with site ID in their prefixes). Put all this down. When you are finished, import a new file to create a new version of these tables.
If you accidentally discard the wrong file or edit the SQL file incorrectly, it may damage your multi-site network. So do this only if you are comfortable with your job in phpMyAdmin. And back up your network first!
Import user
Because users are stored for the entire network rather than for a single site in the network, there is no manual way to export users to or from a site in a WordPress multisite network.
The only way to do this is to use the plug-in approach outlined earlier in this article. Do this after importing all other files and tables.
Note that when you import users in this way, when you attribute the article to the author, they are not recognized as the same user. You need to browse all articles / pages and manually attribute them to the correct author.
Preview your website
After completing the migration of a multi-site subsite or multi-site network, you can easily preview the migrated site by editing your computer’s hosts file. This allows you to point the local DNS to the server that hosts the migrated site.
Summary
Migrating WordPress sites between hosts or from local to remotely installed WordPress sites is something that many WordPress users must do at some point. You can do this in a variety of ways, the main difference being whether you do it manually or using a plug-in.
On the other hand, if you decide to migrate your WordPress site yourself, the above steps will help you migrate reliably and ensure that your new WordPress site is the same as your old site.