The WordPress Codex is a great resource of information but can be a bit overwhelming for some users looking to migrate to a new hosting provider or change domain names.
We created a printable checklist to help with migration. We also covered the issue of SEO and what to do in case things go wrong.
Before You Begin
Please remember to retain an original backup saved in a safe place separate from the actual files you will be working with. Name your file something like: yourfiles_backup.zip. Include site files and database. This should remain untouched and only used if restore methods fail. We will explain back up methods later.
Do not turn off the account for the old hosting provider yet. Leave it active for at least a week in order to give DNS time to resolve and for you to verify files and database.
You should have already prepped other items such as moving email accounts and setting up an account at the new hosting provider and/or decisions about the new domain name with nameserver settings, if applicable. Note: some back up methods explained in this article will also back up your email accounts.
Moving the Files & Database
These options can be mixed and matched to fit your needs.
Ask Your New Host
First, ask your new web host if they provide services to move from your old host. Most provide this service at no cost depending on the server set up.
Using a Plugin: Duplicator
Duplicator allows you to backup and reinstall the database and WordPress files either for safe keeping or to a new hosting provider. It’s a free plugin with the ability to upgrade to pro for larger websites.
The Easy Way: CPanel
Cpanel has built in features for backing up databases and files. It’s even easier if migrating from Cpanel host to another Cpanel host.
Option 1: Cpanel to Another Control Panel
- Login to Cpanel and locate « Backup Wizard ».
- Select the backup option.
- From there you can select « Home Directory » and « MySQL Databases ».
Option 2: Cpanel + File Manager + PHPMyAdmin
- Locate « File Manager » and click the « Document Root » option.
- Right click on the public_html or www folder and press « Compress ». Note the file name.
- When complete, browse to yourwebsite.com/filename.zip
- Go back to the main Cpanel. Find & click « PHPMyAdmin ».
- Click on the main database name.
- Click the « Export » tab.
- Scroll down and click the « Save as File » option and choose the ‘zipped’ compression.
- Click « Go ».
Option 3: Cpanel to Cpanel
- For this option you will need to have Web Host Manager (WHM) part of your account. This is normally for resellers or dedicated servers. Login to WHM.
- Select « Copy multiple accounts/packages from another server ». This option will copy your database, email and all files.
The Manual Way: FTP
File transfer through FTP is the slowest but sometimes the above options don’t work out. Two popular FTP programs are FileZilla and CuteFTP among others. You will only need to worry about files within the /www/ or /public_html/ folder.
Changing the Domain Name
Follow this option when changing URLs or moving from a sub-directory to the root or vice versa. The permalinks will need to be resaved.
Using a Plugin: Go Live Update URLs
Go Live Update URLs is a simple find/replace plugin to change the URL in the database.
Find and replace the full URL with http and without the ending foward slash « / »:
The Easy Way: wp-config.php
Note: this option won’t work for mulitsites.
Go to Settings > General and change the URL in WordPress Address (URL) and Site Address (URL). Save changes.
In wp-config.php, add the following lines at the top:
The Manual Way: Database
If all else fails, you can make the replacement in the database.
- Go to « wp_options ».
- Find and change the option_value for option_name: siteurl
- Find and change the option_value for option_name: home
It should be the full URL with http and without the ending foward slash « / ».
Another way is to update functions.php with:
If Something Goes Wrong
Here are some typical scenarios that may surface while transitioning files or domain names:
I accidentally changed the nameservers on my domain before files were downloaded.
Connect to the server’s IP address or temporarily change the nameservers back. The IP address can be located in the email the hosting company initially sent or you can send an email to tech support. You can either connect via FTP to the IP address or if using Cpanel, visit http://[IP-HERE]/cpanel. So for instance, if I was connecting to IP 127.0.0.1 then the URL to get to Cpanel would be http://127.0.0.1/cpanel. From there just login with the same credentials.
Pages return a 404.
Check the URL was successfully replaced in the database. Resave permalinks in WordPress backend.
Homepage menu link returns a 404.
Go to Appearance > Menus and see if the home link needs to be changed.
Can’t write or add images to the uploads folder.
Change permissions to the wp-content/uploads folder to 755. If that doesn’t work, try 777. And if those permissions don’t work contact your new hosting provider.
If all else fails.
Make a copy of the yourfiles_backup.zip backup and unzip the files. Restore the files & database and re-follow steps above. Pay special attention to the URL change and make sure all files and database information have successfully imported.
Addressing SEO Issues
Now that you’ve successfully changed hosting providers and domain names it’s time to address any potential SEO issues. You only need to take these steps if you changed domain names or moved from a sub-directory. You should make sure DNS has resolved first and the new site is up and running.
While your old domain is still active, you can forward the old domain to the new domain by setting up a 301 permanent redirect to the new URL. Add the following to .htaccess for the old domain. Replace newwebsite.com with your new URL:
Redirect 301 / http://www.newwebsite.com/
If moving from a sub-directory it would be:
Redirect 301 /subdirectory/ http://www.newwebsite.com/
You can test if these changes took place by visiting the domain name in a new browser after saving .htaccess.
Further reading: How do I redirect my site using a .htaccess file?
Notify Google & Bing
Alert site users via a newsletter and social media of the new domain name.
Monitor Dead Links & 404 Errors
Documentation & Resources
- Duplicator For WordPress Quick Overview
- How to use the backup wizard in Cpanel
- cPanel – Site Backup Using phpMyAdmin & cPanel File Manager
- Popular FTP Programs
- Go Live Update URLS
- How do I redirect my site using a .htaccess file?
- Google: Use the change of address tool
- Bing: Site Move
- Google: Submit a sitemap to Google Search Console
- Bing: Sitemaps
- 404 plugins in WordPress Plugin Directory
- 301 Redirect plugins in WordPress Plugin Directory
- Creating an Error 404 Page in WordPress
Stay in Touch
You can get blog updates in 3 ways:
If you have feedback about this article or have ideas for future topics contact me via Twitter or leave your thoughts & feedback in the comments below.