WordPress Migration to a New Web Hosting - Plesk

WordPress Migration to a New Web Hosting

Changing hosting providers can be challenging and having an idea about proper WordPress migration can make the process of changing hosts much easier. There are a lot of reasons why you might want to change web hosting providers, ranging from increasing costs through to poor service provision.

It is common for hosting frustrations to build up over time, whether it is the costs of hosting or a gap in service delivery, like constant downtime. The reason is simple: moving hosts is daunting prospect and many website owners simply put off this decision as long as possible because they are worried that moving hosts will make their existing problems even worse.

Use an expert, or DIY WordPress migration?

One option is to get the help of an expert to make the process of changing hosts easier. Experts can help you find a new host that is suitable. In fact, some hosts can even help you make the transition. Nonetheless it is entirely feasible to transfer a WordPress site on your own, but you need to be aware of some basic principles, which is what this article is all about.

The key lies in preparation. If you go through the right preparatory steps moving your website should be just fine. Approached in the right way, WordPress hosting migration is a cinch. The right steps also help you reverse migration without adverse consequences so that you can step back if you find that you have made a mistake.

Want to try migrating your WordPress site on your own? Here are the five steps you should take.

Prepare to migrate WordPress by backing up and exporting

Whenever you migrate a website you want to be able to go back to your starting point just in case things go wrong, which is why backing up is without a doubt your first step. In any case, a backup is a requirement for shifting a WordPress installation across to another server. As part of the process you will also need to export your WordPress database,

Backing up a WordPress instance to transfer WordPress site

There are many ways on how to backup your WordPress site files ( plugins, themes, core files and uploaded content ):

  1. you may use any of backup plugins
  2. access your host via ssh, archive everything using tar/zip and pass it to another host via scp connection
  3. archive and download the files by utilizing the file managing functionalities of hosting platforms like Plesk Onyx or cPanel
  4. use dedicated WordPress management solutions like Plesk WordPress Toolkit ( if your current host is using Plesk Onyx )
  5. use an FTP app ( such as Filezilla, WinSCP or CuteFTP ) to connect to your web host and download all the files on your host’s machine to your desktop PC. Note that some important files are hidden, including .htaccess but you will be able to view these if you set the right options inside your FTP client. Also note that downloading these files can take a lot of time depending on how expansive your WordPress instance is, and how many media files you use in your website.

Copy your WordPress database

The next important step is to make a copy of your WordPress database, you can get going doing this while you are downloading the site files with FTP. As with files backup, there are many ways on how to copy the database. Let’s focus on the one which utilizes the power of PhpMyAdmin tool.

A WordPress database export is straightforward but there are a couple of steps. First, you need to log into your web server’s hosting control panel (e.g. Plesk Onyx or cPanel ) and open the phpMyAdmin web interface. It shows a list of databases on the left, you need to select the database matching your WordPress installation here. Next, click on the Export tab to access the Export page.

Thankfully phpMyAdmin offers a default setting, called “Quick”, and this is sufficient for what we need to do. Tap Quick and next tap Go so that your database export process starts. It will then download a file to your PC.

Configure the database on your new WordPress hosting server

Before you can try to upload your WordPress site files you first need to set up the WordPress database on your new server. To do this you need to log in to the control panel on your new host. Since MySQL is the most commonly used database so we will use it in this example, but your host may be using a different database app and if that’s the case you need to contact their support team to find out how you need to create a new database.

Let’s focus on two situations, when your host has Plesk Onyx or cPanel.

a) Plesk Onyx: choose “Databases” and click “Add new database”. Add the name of the databases leaving unchanged name’s prefix, select the website your new database will be related to, add user and its password and submit this data.

b) cPanel: first, open MySQL Databases and create a new database with a name that is appropriate for your website. Next, add a MySQL user and include a secure password too. Finally, make sure this account has the right privileges by granting it “All Privileges” rights.

Copy down the database password, and the database name because you will need these for the WordPress configuration file.

Change your WordPress configuration file for WordPress site migration

Every WordPress instance has a configuration file containing the details for WordPress to connect to the site’s database. Find this file in the content you’ve previously backed up, it should be in the root folder in the location where you stored the files. It is called wp-config.php.

Back up this file in another folder on your computer so that you can restore the changes you made in case something else goes wrong later. Now, open the original version with a text editor and make the following modifications:

Edit the database name

Find the line that says

define('DB_NAME', 'database_name');

and change ‘database_name into the name of the new WordPress database that you just created. Currently ‘database_name’ will be the name of your existing database’s name.

Add the new database username and password

Changing the database credentials is just as easy. For the username, find the line

define('DB_USER', 'database_user');

Here you need to update ‘database_user’ so that it contains the username for your new database.

Next, find the line that says:

define('DB_PASSWORD', 'database_password');

Likewise, simply change ‘database_password’ to be your new database password. Once you’re done save the wp-config.php file and close it.

Upload your WordPress database and files

You’re now set to start importing your WordPress site so that you can fire up the site with your new hosting provider.

Importing the database

Start with the database. To do this you need to launch phpMyAdmin from your control panel and select the new database from the options on the left. Next, open the Import tab from the nav bar.

You now need to import the actual database file. Select Choose File in the section that says File to Import and open the file that you previously exported to your desktop PC. Make sure that Partial Import is not selected and make sure that you have set the database type to SQL. That’s it, now click Go.

Note that some larger databases can take a very long time to import successfully, but you will get a confirmation message telling you when the database import is complete.

Upload your site files

With your database prepped and wp-config.php ready you can now upload the files on your site. Just as you did with the download, you now need to connect your FTP program with your new web host. Once done, you browse to the location of your files on your PC. You need to select the right remote directory: this may be the root public_html folder or it may be another folder, check with your host.

Once you’ve picked the right remote directory you can proceed to upload the files. These will now include the wp-config.php file that you have modified to reflect the login details for the database at your new host. Uploading can take longer than downloading, depending on your connection, you may need to leave some time for this to complete.

Finish WordPress migration by transferring your domain and linking to the new URL

Often a migration also involves moving to a new domain. If that’s the case you need to read this step. If however you are keeping your domain you can skip this step. Changing your domain, however, can cause various issues unless you make an effort to mitigate these.

First, people often struggle moving a site to a new domain when they have added a lot of links to internal site posts by using a full URL. Likewise, if you refer to images on your site using a full URL you will break the image link once you change the domain that’s included at the start of every URL.

However, you can automatically search for these links and replace them, one way of doing so is using Search Replace DB, which is a script that you can download from github. Once you’re done with this tool make sure that you delete it, it presents a security risk if it stays around without being used. Also note that you shouldn’t install this tool in the root of your domain, instead create a temporary folder with a completely random name that’s not likely to be guessed.

Changing your WordPress site’s address

Your site URL will also be altered during this search and replace process. In other words, your home URL and site URL values will also be updated to represent the new domain. That’s good because it means that you get directed to the right location when you try and log in to your new site, instead of getting directed to the old location.

Finishing up your migration

You’re nearly done but there are a few more steps you need to complete. There may be a few days of waiting between these steps.

Your website’s domain will still be pointing to your old host and you need to redirect your DNS (domain name server) settings before requests will be directed to your new hosting provider. The process varies depending on where your domain is registered and hosted.

Unfortunately, we can’t give full instructions at this point because the number of different routes are simply too varied, however your domain registrar will be able to assist you. Note that it can take some time before a change in domain details is fully effective, up to 48 hours in fact. This process is known as domain propagation and is, unfortunately, unavoidable.

Importantly you should not make any changes to your site during this period as you may end up changing the site on your original website host, and not your new site instance. After 48 hours you should be just fine to make changes, and to delete the contents of your old site at your old hosting provider. Always keep your backup files that is on your local PC and keep your old wp-config.php file just in case you need to refer to it.

In conclusion we’d suggest that the process of how to move a WordPress site is not complicated, but you should be careful every step of the way. You should also always ensure that you have your original site stored on your PC so that you can go back if there is a problem.

How useful was this post?

Click on a heart to rate it!

Average rating / 5. Vote count:

Oh no, sorry about that!

Let us know how we can do better below


Elvis Plesky
Our fun and curious team mascot's always plugged into the latest trends. He's here to share his knowledge and help you solve your tech problems.

Leave a Comment

Start typing and press Enter to search