How to Migrate a WordPress Site to a New Domain

Moving your WordPress site to a new domain or host can be a daunting task, especially if you haven’t done it before. Sometimes it results in unexpected errors. If the migration is performed correctly, it should be a walk in the park.

Use this tutorial to avoid many of the common problems experienced with migrations.

Deactivate All Plugins

Firstly, it’s recommended to deactivate all plugins, because when moving a WordPress site to a new host, WordPress plugins tend to fail.

To deactivate all activated plugins, go to the admin page -> Plugins > Installed Plugins > Mark all > Bulk action > Deactivate > Apply

The Backup Process

It’s best practice to always backup your website before making any changes, and a WordPress migration is no exception. There are a couple of WordPress plugins for doing this, but a manual approach is best if you want to be in complete control of the process.

Backing up your database

To back up your WordPress database manually, log in to your phpMyAdmin which you can find on your domain hostings cPanel or Konsole, click on Manage MySQL or your WordPress Database Manager. This will load a new phpMyAdmin window, then select the Export tab.

Make sure that the format is set to SQL and click Go. Your WordPress database will then be downloaded as a .sql file. It’s recommend that you move the downloaded SQL file from your downloads folder to another folder on your computer so that you can find it later, and then use this folder for future backups.

Backing up your content

It’s recommended that you download your complete WordPress installation folder so that you won’t lose anything.

Using an FTP client like FileZilla, log in to your host by FTP and download your www, httpdocs or public_html folder, or wherever your WordPress content lays.

Once FileZilla is installed, open it up and select  -> Site Manager New Site > Enter your FTP Credentials > Click Ok (to save it for future use)

Then select the dropdown arrow next to Site Manager and select your site. If it logs in correctly, you should now be able to view all your WordPress Content as below.
The folder I need to backup in my case is public_html, the best place to back it up to would be the same folder where you stored your MySQL database earlier on.

To start the backup process, on the left pane simply navigate to the folder where your database is stored, click and drag the public_html folder to the folder in the left pane.

This may take a while, depending on the size of your WordPress Site.

Restore Your Database and Content

Now that you have the backup, a few things must be modified before moving on to uploading the backups. Before proceeding, log in to phpMyAdmin of your new host and create a new database.

Select the new database and click on the Import Tab > Choose File(browse to the folder where you saved it earlier) > Select Go:

This will upload the database file, and import all the data into the new database. Don’t close phpMyAdmin just yet, you still need to edit your URL paths. To do this, select the SQL tab in phpMyAdmin, copy and paste the following code and change everywhere it says oldurl and newurl(see the image example below):


UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

Run the command, by clicking GO at the bottom of the window.

Editing your WordPress Config

The next step is to edit your wp-config.php file before restoring the site content.

Find the wp-config.php in the backup of your sites content.

You can open this file with any notepad, however I reccommend using this Free Programmers Notepad, which allows you to open many different file formats, and could be handy in future.

Edit the lines below, replace with the details of your new host and save the changes.

All you need to do now, is restore your WordPress content backup. Once again use FileZilla the same way you did when backing up your old sites content.

This time you’ll FTP into the new host, find the public_html folder and drag and drop all the files from your backup into this folder.

Your website should automatically come online once the upload completes, provided all the above steps were done correctly.

Go grab a cup of coffee , you’re almost done – uploads take longer than downloads, especially if your on broadband/ADSL.

Once your website is online, login with your old WordPress Admin username and password(you havent changed this so it should still work) then reactivate all your plugins to restore your sites full functionality.

Lastly update your permalinks, navigate to Settings > Permalinks, select the preferred permalinks structure and Save Changes.

Hopefully this tutorial has been helpful, if not we recommend using a plugin that helps you with the backup and restore process:

UpdraftsPlus Backup and Restoration Plugin

This plugin will make the backup and restore process simpler, but you will still need to complete all the other steps mentioned above.

If you need help with migrating your website to another host, you may contact us for assistance for a small fee of $29.00 to perform the complete migration process for you.

We'll help you - get in touch!

Care to Share

Share this post with your friends!