When I was migrating my WordPress sites, I ran in to a few issues and couldn’t figure out why. I’m making this guide to help out those that are going through the same issues. First I’ll map out how to do the migration efficiently. You could always see if your new host can do it, basically copying all your databases and your whole root folder. Then I’m not sure what else they do but I wanted to figure it out on my own. I didn’t make any nameserver changes initially. I wanted to make sure it was easy to access the working live site before I made the changes.
Export the Database
- Install WP Migrate DB on the existing live site. This is the easiest method I have found so do this first. Activate it and go to Tools > Migrate DB.
- You’ll need to fill out the new URL and new file path. Most likely the URL will be the same but the file path will be different. Mine went from “/home1/username/public_html/domain.com” to “/home/newusername/public_html/domain.com.”
- The other options are up to you. I left spam comments out and used the gzip.
- Click Export Database.
Download the WP files
- Login to the live site’s CPanel. Open File Manager and navigate to the domain you want to move.
- Compress the directory and all the enclosed files.
- Locate the zip file and download it.
Create a New Database
- Login to your new server’s CPanel.
Open the MySQL Database Wizard and create a database using the same name as your old one. Create a user with the same credentials too.
- Open phpMyAdmin and you’ll see the empty database you just created. Click on the Import tab and upload the SQL file you got in Export the Database above.
Upload the WP Files
- In the new server’s CPanel, open up the File Manager. If this is not the domain you used to set up the hosting account, you’ll need to open Addon Domain. That’ll create the domain folder for you.
- This is where you want to upload the zip file you downloaded in the Download the WP files step above.
- Extract the files.
- If you didn’t use the same database name or credentials when setting up the new one, edit this in the wp-config file. That should be in the root of the domain folder.
- On one site, clicking on any posts or pages after the migration resulted in a 404 error. All I had to do is go to Settings > Permalinks and save the default option, then re-save the Post name option.
- I had a bunch of plugins that needed to be updated but when I tried to do this on the new server, WordPress would ask for my FTP credentials. For me, it turned out to be a PHP issue. I contacted KnownHost and they changed something with PHP. One solution that I’ve seen work is to add the following code to your wp-config file.
define( 'FTP_USER', 'username' ); define( 'FTP_PASS', 'password' ); define( 'FTP_HOST', 'ftp.example.org:21' );
I’ll update this file if I can think of any other errors that I encountered. Moving your WordPress site is not as daunting as you might think. If you need any help, feel free to email me.