How to Migrate a WordPress Site
In this post we are going to demonstrate how to migrate a wordpress site from one host to another. Without tears, rage or self harm! The first thing you will need is time. This is not a job to be rushed!
We are seeing increasing numbers of clients who are unhappy with their hosting arrangements. It may be because they get charged unrealistic sums for maintenance,it may be because the performance of the site is poor. The site may have been hacked. There are lots of reasons to review your hosting and make sure you have a good deal that will serve you well for a few years.
The thing is the reason most people stay with the same host is because they think that technically it is too difficult. We have migrated six WordPress websites to new hosts so far this year and we can tell you without any doubt that it is quite possible to do without any noticeable downtime if you have the right tools and skillset.
We wrote a useful article on what a good hosting deal looks like in 2021.
How to Migrate a WordPress Site
We’re going assume that you’re migrating the web site, leaving your domain name at the same registrar. We’ll explain how to migrate the domain name to a new registrar at the end.
WordPress Migration Process
Firstly we look at the prerequisites. These are the things you need to be prepared to do.
- Alter the Name Server setting in your domain name registrar settings. Don’t do that yet, just know that you’re going to have to change them to avoid any downtime.
- Have web space arranged for the new host – write down the name servers for that new host
- A period of time to test the new site
- Redirect the traffic from old to new host
- Turn off the old site
Let’s go through the manual steps and explain them, before looking at the plugins available to make this task easier. This way, you will be better informed when you come to use any kind of automation.
The name server is held by the registrar of your domain name and propagated all over the internet so that when somebody types “helterskelterdesign.co” into their web browser, it goes away and looks up the Name Server and from there the IP address of the web site. This will need to be changed but first, you’ll need to migrate the web site content.
- Please, please please…Backup your files before you get started. If anything goes wrong during the migration process you will still have your content intact.
- Disable all of your plugins.
- Use FTP to download the entire wp-content folder. This contains amongst other things all of the pictures you have uploaded to your site.
- Export the database files. Easier than it sounds! Go to the cPanel, open phpMyAdmin, and click on the “Export” tab. Then click on “Go”. The output is a file that you can import into your new database.Break for Coffee…
- Install WordPress in your new host.
- Import the database. Go to the cPanel, open phpMyAdmin, and click on the “Import” tab. Then click on “Go”, use the output file from step 3. You will import your old set of tables to the new database.
- Upload the wp-content folder. Overwrite the wp-content folder on your new host with the version you downloaded in step 2.
- Update Database references in wp-config.php – table prefix, user name, password to point to your new set of tables.
- Sign on as administrator and activate the plugins one by one.
There are some premium plugins that can be very helpful in the process, automating some of the steps and making some of the complicated stuff more accessible.
This list covers plugins we have actually used. There are others but since we haven’t tried them, we won’t include them here.
This is our favourite, currently. Why? Because it makes the entire business straightforward and we haven’t had any disasters with it. Download Duplicator Pro here.
You install the plugin in the website that is to be moved and follow the prompts to create an image of the site. This image includes your database tables. The software will run for a while and then create two files. One is an archive, the other an installer.
You now need to create a database in the destination environment. Write down the prefix and the user credentials.
Move both files to the root of your new environment and then access the installer via the web.
Open a browser and invoke the installer by typing the line http://mywebsite.com/installer.php
This will open a screen in your browser that guides you through the remaining steps.
Duplicator Pro can also deal with migrating a WordPress Multisite and separating a single instance out as a standalone site.
If you do this, Duplicator pro makes an excellent job of changing the media library to the default path for a single website, but it doesn’t alter the paths to images embedded in the text of the site. To be fair, this is not a straightforward task and it’s not difficult to do this manually. Find the missing links and rewrite them to the new format. (If you’re not sure what this is you can find the image in the media library and get the address from there).
Migrate DB Pro
This is a great plugin.
Aimed at developers, the plugin syncs data (themes, plugin, media libraries and database) between two servers. This makes it ideal for a dev/staging/production workflow. It’s a little pricey, but offers a reliable platform for developers to push/pull latest versions of websites between environments.
Migrate DB Pro can extract the tables from a multisite install and uses search and replace to alter the values so that a multisite to single site migration is supported.
Download Migrate DB Pro here.
This is primarily a back up solution but every backup can be installed somewhere otherwise what’s the point? It does not have the flexibility of the other two regarding multisite, but it is perfectly usable if you’re not changing the domain or the name of the site. Does not support multisite to single site migration.
Now remember when we said you’d leave your domain name with the old registrar? That was because you’ll need to test your new site. Thoroughly. Over a period of days to be sure that the migration was successful.
First you need to change the hosts file (etc/hosts on OSX or Linux) on the computer you are using so that the domain name you are using points to the new host. You should be able to find the IP address of your new site in the admin panel. The new entry at the end of your hosts file should look like helterskelterdigital.com 123.321.123.012 where helterskelterdesign.co is your domain name and 123.321.123.012 is the IP address of the server you are migrating to.
Empty your browser cache at this stage to be absolutely sure that the content you are viewing is being served from the new install and not your local cache.
Migrating the Domain
Once you have tested everything to your satisfaction, go to your old host and change the Nameserver entries in the DNS settings for your domain name to point to the Nameservers of your new host – you should be able to find these in the admin panel too. This may take several hours to be fully effective, during which time content may be served from both sites. Leave it for 24 hours to be sure. Now your site is migrated and all traffic will be coming to your new site.
Optionally at this stage, you may want to bring the domain name over to your new provider. You’ll need an EPP code from your old provider to do this, but most will have a screen in domains that allows you to unlock the domain (to make it available for transfer) and generate the EPP code. Copy the EPP code and at your new hosts admin screen for domains, check “Import Domain” and follow the prompts, inputting your domain name and the EPP code.
Don’t forget that your email is associated with your domain – so if you’re going to migrate the domain name too then you’ll also need to change the MX record to reflect the new mail server address.
Now you’re completely migrated. Another brew…
WordPress migration, especially involving production sites requires specialist knowledge even if you’re using a plugin.
The golden rules are:
- Back up everything
- Think through what you are doing in advance of doing it
- Make notes of user names and passwords
- Deactivate security plugins
- If you think it’s complicated, it probably is!
If you’re not confident to tackle this process on your own, we can help. We provide WordPress site migrations as part of our service.
Growing a business? We’ll deliver Insight direct to your inbox.
Once a month actionable tips to put your website front and centre..