Migrate WordPress

How Can We Help?

Migrate WordPress

You are here:
< Back to the Wiki

Are you planning on Migrating your WordPress website? Do you want to migrate/restore a WordPress backup? Or do you simply want to change the website URL of WordPress? This article will help you with some tips and tricks to achieve these goals.

Prerequisites

For restoring or migrating a WordPress website, it is assumed that you are in possession of a WordPress backup. This article will cover backups made by UpdraftPlus (updraftplus.com).

Migrating or Recovering a WordPress Website

To migrate or recover a WordPress website, make sure you have an empty WordPress installation with UpdraftPlus (Premium) or UpdraftPlus Migrator.

Navigate to UpdraftPlus in your WordPress admin panel and upload your backup. Once it is uploaded click Restore. UpdraftPlus will detect if it is a recovery or migration and take the appropriate steps. Once the migration is started you will have to wait until UpdraftPlus either reports that the migration/restoration is successful or it will reload the webpage and prompt for the login. Make sure to log in with your credentials from the backup!

Aftercare

Once you have restored your WordPress instance make sure to check the following aspects for a fully functioning website.

Database

Updraft is not perfect, your database might still have traces of the old domain name. Use a plugin like Better Search Replace (wordpress.org) to replace the domain name in your database.

Domain Configurations

If you performed a domain name migration, it might be that connected services are expecting your old domain name. Therefore, check your website and plugins if they are set up properly. i.e.:

  • Relogin to Google Analytics to start analyzing your traffic again
  • Either create a new or extend your ReCAPTCHA’s domain if you have any

Functionality

Check if your website functions as expected. Once you are satisfied make sure to use a plugin like UpdraftPlus (updraftplus.com) and set it up again to have back ups.

Change WordPress URL

To change your WordPress website URL open the wp-config.php file and edit / create the following lines:

define( 'WP_HOME', 'https://wordpress.example.com' );
define( 'WP_SITEURL', 'https://wordpress.example.com' );

After changing the URL it is recommended to install a plugin like Better Search Replace (wordpress.org). This plugin can help you to replace the remaining old URLs in your database with new ones!

Alternatively, you can also perform these steps manually using the database. To do this log in to your database using mysql -u __USER__ -p and fill in your password. Now select the correct database by using USE __MY_WORDPRESS_DATABASE_NAME__. Next, use the following commands to find and replace your website URL:

-- Show the records with the old URL
SELECT * FROM wp_options WHERE option_value = 'https://wordpress-old.example.com';
-- Update the old URL to the new URL
UPDATE wp_options SET option_value = 'https://wordpress-new.example.com' WHERE option_value = 'https://wordpress-old.example.com';

Now exit the database using QUIT;. Take note that these commands do not replace the URL in the entire database, therefore, it is recommended to install a plugin like Better Search Replace (wordpress.org), to replace the remainder.

Sources

2 Responses

  1. Roger says:

    Your blog consistently captures my attention, compelling me to read every word with great interest.

  2. Clarissa says:

    Appreciate you sharing this informative post. I picked up a lot from it and the writing is clearly articulated. Keep it up!

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents