Learning how to migrate a WordPress site can seem like a big task if it’s your first time, but it’s actually easier than it appears. Businesses and websites grow and become more demanding of their hosts, which sometimes means that your website needs to move into a larger space in order to expand.
Often times, the web designer who originally created the site has moved on to other projects and cannot be bothered to move your website for you, leaving you with some decisions to make — look for a host that offers migration services, hire a professional, or perform website surgery on your own.
How to migrate a WordPress site
While paying a professional is a sure-fire way to ensure it gets done right, you should try to learn how to migrate a WordPress site on your own before spending your hard-earned cash. Why? Because the migration is easily reversible, and managing your website is a good skill to have.
- Back up your website files.
- Export the database.
- Upload website files.
- Create a database on the destination.
- Import the database.
- Fix the wp-config.php.
Let’s go through all of the necessary steps to quickly and easily learn how to migrate a WordPress site.
1. Back up your website files
So first thing’s first, we have to retrieve your website files from the original host. We will be using file transfer protocol (FTP) to download them to your local computer. If you don’t already have a favorite FTP client, we will be using FileZilla.
Log in to your web host and copy all of the files from your website’s root directory to a folder on your local computer.
Depending on the amount of installed plugins and uploads, this process can take some time to complete. Once the transfer is complete, we can move on to copying the database.
2. Export the database
The database is the most important piece of your WordPress site — it’s the brain and holds all of your pages and posts. Surprisingly, it is also the easiest to make a copy of. Most hosts offer access to your database through phpMyAdmin.
Simply log in to your host control panel and access phpMyAdmin.
Select your website’s database from the left column and then click Export from the top menu bar.
The export method should default to Quick, which is acceptable for these purposes. You’ll also want to make sure that the format is SQL. This will ensure that your backup is universally acceptable for MySQL.
Then you’ll click Go, and you’ll be prompted to download the .sql file. Move this file into the same folder as your website to keep track of it while we complete the migration.
3. Upload website files
Now that we have the website copied, we can use the same method that we used to back up the website files to upload them to the destination host.
Log in to the destination account using FileZilla and browse to the web root of the destination hosting account. If you are using cPanel, this is typically the public_html/ folder.
Then, drag your website files from your local computer to the new host’s web root. Depending on the size of your uploads folder and plugins, this process may take some time.
4. Create a database on the destination
Before we can migrate your database to your new host, an empty database must be created first.
Log into the destination account’s control panel. If you are using cPanel, you are looking for the option MySQL® Databases.
Create a new database and name it appropriately for your site.
Once you’ve created the database, create a new database user and then add the new user to the new database with ALL PRIVILEGES. Make sure to write down the database name, username, and password — you’ll need them for later.
5. Import the database
Once the database has been properly set up, we can import the database. The steps will be similar to the way we exported the database.
Log in to phpMyAdmin on the destination account and click on the name of the new database that you just created. Then on the top bar click Import.
Like before, you won’t have to change any of the settings — just click the browse button and select your .sql file that you made earlier.
Click Go, and the database will begin importing. Depending on the size of your site, this process might take some time to complete.
6. Fix the wp-config.php
We have moved all of your data successfully, but alas the site is not loading correctly on the new host! We now have to bring the files and the database together by modifying the wp-config.php file.
You can edit this file in FileZilla by right-clicking on it and selecting edit (cPanel also provides a file manager where you can make edits to this file). What you’re looking for are the following settings in this file:
define('DB_NAME', 'new_db'); define('DB_USER', 'new_db_username'); define('DB_PASSWORD', 'new_db_password'); define('DB_HOST', 'localhost');
Take the database information that you wrote down earlier and replace the old database information in these lines of code with the new credentials. Take the database information that you wrote down earlier and replace the old database information in these lines of code with the new credentials.
At this point, your website should be in working order if the domain has remained the same during the move and DNS is already set up. However, there are a few different scenarios that might be keeping you from success.
Some finishing touches
There are a few small details that might keep your migration from being complete at this point.
If the domain of your website is also changing during this migration, then the site URL and homURLrl will need to be changed to reflect the new domain. You can do this temporarily by adding the following lines to your wp-config.php file with your domain replacing the text “example.com”:
If the domain is going to be the same after the migration, then at this point you’ll only need to change the A record for your domain to point to the IP address of your new hosting account. This process varies between registrars, so it’s best to discover how to do this part with whomever you purchased your domain from.
Congratulations! You’ve successfully learned how to migrate a WordPress site. That folder that you downloaded your website files and database to on your local machine can be saved and kept somewhere safe, because it now serves as a backup of your website in case of emergencies.
Remember that all websites are built differently, and sometimes extra unforeseen steps might be needed if your website is more complex. Keep practicing and remember that you can always go back a step and retry.
Editor’s note: Looking for an easier way to migrate a WordPress site? Check out GoDaddy Pro Hub, available for free with GoDaddy Pro. The GoDaddy Hub includes streamlined migration and backups for WordPress websites, regardless of where the website is hosted.
Meet the 27-hour day.
We built The Hub by GoDaddy Pro to save you time. Lots of time. Our members report saving an average three hours each month for every client website they maintain. Are you adding that kind of time to your day?