At Hoopstudio Technologies, we do a lot of WordPress migrations, whether its launching new websites or simply moving a client’s site to a new host. Based on our experience, we know that performing a migration — especially on a fully live & functional website — can be a nerve-racking and traumatic experience without the proper road map. There’s nothing worse than sending a client’s website down during business hours and having no idea what caused it, nor how to fix it.
We created this comprehensive step-by-step guide to document the process we use for performing a WordPress migration.
Please note: There are much faster & more efficient ways to clone a WordPress website than the process outlined below (ManageWP, for example, is a great app that can clone WordPress sites in a few minutes)
However there is one big advantage to using the following process, which is that it allows you to both migrate AND preview the website on the new host without updating your DNS. This means that your site will not have to incur any downtime during the migration, making for a 100% seamless transition. It is for this reason alone that I use this process when migrating a live website.
Contents
I. Export the Database
II. Install WordPress on Your New Host
III. Import the Database
IV. Migrate the wp-content folder & wp-config file
V. Testing & Troubleshooting
VI. Wrapping Up
I. Export The Database
1. Download & Install the WP Migrate DB plugin on your site. This is a great plugin that provides superior exporting capabilities beyond WordPress’s default Export feature. It’s built specifically for performing migrations, as opposed to a mere backup. Key features include automatic URL re-writing so that all of your links continue to work at the new location, even if the domain is different. I’ve performed dozens of migrations using this plugin and can attest to its power.
2. After activiating the plugin, navigate to Tools > WP Migrate DB
3. Enter the New address (URL) for the website. If you are simply changing hosts and not changing the domain, the New URL will be the same.
4. Enter the New File Path for the website. This is the FULL file path starting from the server root. You may have to check your new host’s control panel or account page to obtain this path. It can also sometimes be found in the address bar of your FTP client.
5. Make sure “Save as file to your computer” is checked.
6. Click “Export Database.” It may take a few minutes for the file to begin downloading.
II. Install WordPress on Your New Host
1. Go to your new host and install WordPress. You can use a 1-click install (if your host has one) or you can install WordPress manually via FTP.
2. Make sure you fully complete the installation process. If you’re going to be using the same domain name at the new host, you may have to modify your hosts file to switch back and forth between the two WordPress installations during the rest of the migration process.
See Also: How to Preview a Website Before Updating the DNS
III. Importing the Database
1. Log in to the database for the new WordPress installation. Your host should have a link to manage databases from the control panel.
You’ll need to find the name of the new database, and log in to it using the database username & password you established when installing WordPress.
If you used a 1-click Install you may not know what these values are. In this case you can always obtain them from the file wp-config.php in the root of the WordPress installation:
Note that for the purposes of this tutorial I am assuming your host is set up with phpMyAdmin for database management.
2. Once logged in, navigate to the Import tab and click “Choose File.”
4. Select the database file you previously downloaded from the original WordPress installation. You may have to look in your browser’s downloads folder. The file will end with the extension “.sql”.
5. Click “Go”.
6. When the import is finished, you’ll see a yellow dialog box that says “Import has been successfully finished…” You should see the newly imported tables listed on the lefthand side.
Note: In most cases the database import will (and should) automatically overwrite the original database tables (from the fresh WP install) with the tables from the site you are migrating.
If the tables you’re importing have a different or modified prefix other than just “wp_” (like above), the original tables may still remain. This is fine, but you may want to delete the original default tables to avoid confusion.
IV. Migrate the wp-content folder & wp-config file
The last thing we need to do to complete the migration is to copy the wp-content folder &wp-config file from the old host over to the new.
The wp-content folder is located in the root of every WordPress installation and contains important items such as theme files, plugins, and uploaded images.
The wp-config.php file is also located in the root of every WordPress installation, an essentially servers as a “base configuration” file for WordPress.
1. Log into your website’s OLD (current) host via FTP
2. Locate the file named wp-config.php and download it to your machine.
3. Open this wp-config file and change the following settings to the same values as the wp-config file in the new WordPress installation (as seen in Part III, Step 1):
DB_NAME
DB_USER
DB_PASSWORD
DB_HOST
Doing this will ensure that WordPress knows to pull data from the new database once we upload this file to the new hsot.
4. Locate the wp-content folder of the original installation & download the entire directory to your machine. Log out of the FTP session when it the download is finished.
5. Log into your NEW host via FTP. If your new host uses your domain name as the FTP hostname, you may need to modify your hosts file before logging in.
6. Locate the directory where the new WordPress installation resides.
7. Delete or rename the existing wp-content folder on the remote server.
8. Rename, but DO NOT DELETE, the wp-config.php file on the remote server. I usually rename it to something like wp-config-backup.php. We will save this file as a reference in case something was not updated properly in the new version of the file.
9. Upload the wp-content folder that you just downloaded into this same directory. This will effectively replace the default version of the wp-content folder with the version from the site you’re migrating, copying over all of your themes, plugins & uploads.
10. Then, upload the wp-config.php file that you just downloaded into this same directory.
V. Testing & Troubleshooting
At this point you have done everything needed to migrate your WordPress site to a new host. If the new host will be using the same domain name as the old site, you shouldmodify your hosts file to preview the new version of the website.
Open a new browser session, type in your URL, and if you’ve done everything right you will see a perfect copy of your website on the new host.
If you see the message “Error establishing a database connection”: This likely means that you did not update your settings properly in the wp-config file. Re-open the file and compare it to wp-config-backup to make sure the database name, user, password & host are all the same.
If you see the message “500 Internal Server Error”: There may be an incompatibility with the .htaccess file. Go to your WordPress root directory and delete the .htaccess file, then try re-loading the site. WordPress will automatically create a new .htaccess file to replace it.
If some pages of the website generate a 404 error: You may need to refresh your permalink settings. Log in to the WordPress dashboard and navigate to Settings -> Permalinks. Simply loading this page will cause WordPress to refresh the permalinks settings. Return to the main site and try those pages again.
VI. Wrapping Up
Once you’ve tested the site on your new host & eliminated any error messages, you should now be ready to start using the site at it’s new home. If you are using the same domain name, now would be the time to update your DNS settings at your domain registrar, to point your domain name to the new host.
If you find it’s very difficult for you to do the migration or you would want to save your valuable time doing more important things, you could consider engage our team to help with a smooth migration here