How to migrate a WordPress website with themes and plugins step by step guide

Migrating WordPress may seem like a daunting and possibly dangerous task. While it’s not as hard as it may seem to be, it is important that you do certain things to make your migration a success. It isn’t quite as simple as just moving your public_html folder over to the new server, especially if you are switching domains. This how to migrate your WordPress website with all your themes, plugins, and content:

Switching Domains

If you are switching domains, you will need to update WordPress to reflect the domain change before you make any copies and start moving them over. Go to Settings > General and change the WordPress address and site address to reflect your new domain’s settings. Finally, click “Save Changes” down at the bottom. Note that this will temporarily break your WordPress website until you move it to the new domain.

Making Backups of Your Home Folder and Database

There are several ways you can make backups of your home folder and database. If you have CPanel, the easiest way is through here. If you don’t have CPanel, you will have to go through a slightly more technical method.

Creating and Restoring a CPanel Backup of Your Home Folder and Database

To create a CPanel backup of your home folder and database, go to Files > Backup in the CPanel menu. On the following screen, click the “Home Directory” button under “Download a Home Directory Backup” and select where you would like to save the file. Below “Download a MySQL Database Backup”, click on your WordPress database name and select where you would like to save the file.

Log into CPanel on your new server and navigate to Files > Backup again. This time you’re going to click on “Choose File” under “Restore a Home Directory Backup” and select the home directory backup file you downloaded. Next, click “Upload”. Then click on “Choose File” under “Restore a MySQL Database Backup” and select the database backup file you downloaded. Finally, click “Upload”.

Creating and Restoring a Softaculous Backup of Your Home Folder and Database

To create a Softaculous back of your home folder and database, open up Softaculous and go to the “Installed” menu. Find your WordPress website in the list and click the backup button to the right of your WordPress installation. Make sure that both “Backup Directory” and “Backup Database” have check marks next to them. For “Backup Location” select the folder on your server you would like to back up to (you can download this later). Finally, click on “Backup Installation” to create the backup. Next, log in to your old server via FTP and download the backup you made.

Now, log into your new server via FTP and go to the /.softaculous/backups directory. Upload the backup file you downloaded here. Open up Softaculous and go to the “Backups” menu. You should see your backup listed here. Click on the “Restore” button next to the backup. Make sure both “Directory” and “Database” have check marks next to them, then click “Restore Installation”. Once this process completes, you’ve restored your website and can move on to creating a new database user.

Creating and Restoring a Manual Backup of Your Home Folder and Database

To create a manual backup of your home folder and database, start by logging in to your old site via FTP and downloading the contents of public_html. Once you have finished this, log in to PHPMyAdmin and select your WordPress database on the left-hand side of the PHPMyAdmin window. Next, click on “Export” at the top of the PHPMyAdmin window. Keep the settings on quick, and make sure the format is “SQL”. Next, click “Go” and select where you would like to save the database file.

On the new server, login via FTP and upload the contents of your old public_html folder to the new one. Next, go to PHPMyAdmin and click “Import” at the top of the PHPMyAdmin window. Click “Choose File” and select the database file you downloaded earlier. Make sure the format is set to “SQL”, then click “Go”. This will complete the process of uploading your old database on to the new server.

Creating a New Database User

You will also need to create a database user identical to the one your WordPress installation uses to login, with the same password. If you don’t know this information, you can find it in the wp-config.php file in your public_html folder.

This can be done in CPanel on the new server by going to Databases > MySQL Databases. Scroll down to MySQL Users > Add New User. If this area is already populated with a name that precedes any username you create, you will need to update the wp-config.php file to reflect this change. Otherwise, just type in the same name that is contained in your wp-config.php file, and also use the same password. Finally, click “Create User”.

Alternatively, you can also do this in PHPMyAdmin. Start by clicking “Users” in the top menu of the PHPMyAdmin page. Then click on “Add User” at the bottom of the page. Create an username and password that matches what is in your wp-config.php file, then click “Save”.

Visit your new site in a browser to make sure everything worked. If it didn’t, move to the next section of this article.

Troubleshooting WordPress Migrations Gone Wrong

A WordPress migration gone wrong can be easily fixed as long as you still have access to the old server. Here are some common WordPress migration issues and how to fix them:

Redirect Errors and 404 Errors

This happens when custom links and images haven’t updated to the new domain. This can be fixed in PHPMyAdmin. Click on “SQL” in the top menu and apply the following statements, replacing the words “olddomain” and “newdomain” with the appropriate info:

Images Displaying Thumbnails

Sometimes during a WordPress migration, the images do not return to their standard sizing, resulting in ugly oversized thumbnails being produced. This can be easily fixed by installing the Regenerate Thumbnails plugin. Once it’s installed, go to Regenerate Thumbnails in the Tools menu in WordPress and click the “Regenerate all thumbnails” button. This will start the process of resizing your images to their proper specifications.

“Internal Server Error”

Sometimes your new host may have restrictions placed on file permissions, which if you have certain file permissions set can result in an “Internal Server Error”. If you have SSH access to your server, you can fix this by issuing the following command, replacing “/file/path” with the path to your WordPress installation:

chmod -R 644 /file/path

This can also be done via FTP by changing permissions on your WordPress directory and files to allowing the user to read and write and all others to read only.

Sweet Success?

If you followed these directions correctly, your WordPress migration should have been a success. If not, you may need to get your web hosting provider involved to troubleshoot what went wrong. Make sure to keep the backups you made of your original site, and keep the original site running until you have successfully migrated WordPress to the new site location. This can prove invaluable to troubleshooting.