There are times when you will need to migrate a WordPress website to a new host or a different server. Perhaps you want to change a website’s structure, optimize it for mobile or you may just be dissatisfied with your current server’s service and performance.
Migrating can solve your problem and go smoothly – as long as you take the necessary steps to avoid data loss and downtime. Like any project, understanding what to do before jumping in is key. Here’s what you need to know:
What to do before you migrate a website
As with any web project, success starts with advance prep. So, what should you do before you migrate a website? Before you roll up your sleeves and get started, follow these three steps:
The size of your database will determine how quickly your migration will happen. No matter if you have a mega ecommerce site or a site with only a few plugins, take the time to make your file and database size as small as possible. You can do that by removing all backups, cache directories from old plugins, unused themes, plugins and videos.
Next, do some advance prep. You don’t want to lose orders, visibility or functionality. Take these steps:
- Take inventory of all the content so you have a checklist of everything that must migrate from point A to point B. If you identify content that does not need to migrate, eliminate it. You want to transfer only the content that is current.
- Note your current themes. Review your theme files and note any additions you made to code.
- Take inventory of your network resources and configurations including IP information, domain names, firewall access control lists, internal and external DNS entries.
- Contact the provider who issued your SSL certificate to understand the terms and conditions related to migrating your site.
- Understand the size of your website. Some are too big (over 1GB) to manually or automatically migrate. Rather than guessing based on size of tables, number of posts or inventory of orders, export a compressed SQL file to understand the actual size of your database. For large databases, plan on migrating using SSH commands.
Are you migrating a large ecommerce site? Take some extra steps to make sure your product data, customer data and order histories transfer. Organize all your user, product and catalog data and highlight what should be migrated.
Finally, as part of your preparation, enable a maintenance page that will provide a user-friendly message to users with alternative links to visit when the site is undergoing migration.
Step 1: Back up your website files
Backup is important because if you run into a problem during migration — like corrupted or missing files — you’ll be able to restore that data from your backup.
Start by retrieving your website files from the original host. You can use file transfer protocol (FTP) to download them to your local computer. Then, 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.
Step 2: Export the database
Once the transfer is complete, you can move on to copying the database. The database is the most important piece of your WordPress site — it’s the brain that holds all of your pages and posts.
Similar to the file backup, you will start by making a copy of the database. Most hosts offer access to a database through phpMyAdmin. To copy the database:
- 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.
- 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 you complete the migration.
When migrating your client’s WordPress site, be aware of database size. Database export or import might fail due to database size. Some big databases can only be imported via SSH. You should check your customers’ database size, which one is the biggest table, how many posts there are, and how many orders for WooCommerce installations. The answers to these questions can determine if your client’s site is a good fit for the hosting which you are trying to migrate it to.
Choosing between a manual site migration or an automatic site migration
With migration prep completed, you can continue to the next step and decide if you want to migrate your website manually or automatically.
Manual migration is just what it sounds like: copying and pasting your existing website data by hand. With a manual migration, you will need to be comfortable accessing databases, transferring them and then editing the wp-config.php file. You can do it all through the file manager on your hosting control panel or you can use an FTP client. If you choose manual migration, keep in mind the pros and cons:
- You can review the content during the entire process. You’ll be able to ensure each piece of content is placed and linked correctly as you migrate it.
- Manual migration is not suitable for large sites.
- You will need some experience in coding.
- Manual migration can take up a lot more time compared to automatic migration.
- Manual migration leaves more room for human error. You will need to build in extra time for testing and verification after migration.
For an automated WordPress migration, you use custom applications, extensions developed by CMS platform vendors or universal migration tools that will move all your website data from one platform to another. If you choose automated migration, keep in mind the pros and cons:
- Automated WordPress migration is an efficient method for large sites.
- You do not need coding skills to do automated migration.
- Compared to manual migration, automated migration is much faster.
- Even though most hosts offer free migration, sometimes there is a cost associated with purchasing or developing the tools needed to automate migration.
- No matter if you do an automated or manual migration, customized data or content may not migrate depending on the tool used.
For either process, you will need to select a plugin, a software add-on that gives you the functionality to do a migration. Options abound, but you may want to check GoDaddy’s free migration on Managed WordPress, or select the free Duplicator or All-in-One WP Migration tool. For either, you simply set up the plugin and use the Import function.
How to automatically migrate a WordPress site
If you choose to automatically migrate your WordPress site, be sure to have the new site’s login details including username and password as well as the link to the old site. There are many plugins and tools that you can use to do it, such as:
Many hosts also offer easy automated migrations.
With Managed WordPress by GoDaddy, you can just enter your WordPress site and credentials to get your site migrated.
- Go to the GoDaddy product page, in the Managed WordPress section, select Manage All.
- Next to Managed WordPress, select + Create Site.
- From the list of Your existing plans, select the Managed WordPress plan you want to use for the site you’re moving, and then select Next.
- Select Migrate an existing WordPress site.
- Fill out the remaining fields to get your site migrated.
- It may take a while before the migration is completed, larger and more complex sites could take more time. We’ll send an email when we’re finished migrating your site.
How to manually migrate a WordPress site
If you choose to manually migrate your WordPress site, follow these steps:
- Step 1: To upload your website files, 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.
- Step 2: Create a database in the new destination by logging in to 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.
- Step 3: Import the database by logging 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. 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.
- Step 4: Next, fix the wp-config.php file to meld the files and database. 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.
What to do after migrating a website
So, what should you do after migrating a website?
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. But if you need to do a domain change, the site URL and home URL 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 you don’t want to add temporary domains, you can use a host file to preview your client’s website on a new hosting before going live with DNS change. You can do this by adding entries to the host’s file on your local computer.
You should also do a general “find and replace” to find all instances of the old URL. Often, these URLs end up in many more places than just the configuration. Plugins such as the Better Search Replace can be helpful in speeding up this process.
If the domain will remain the same after the migration, 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.
Additionally, some WordPress themes also require additional steps after you complete the previously mentioned steps. For example, if you’re using the Avada theme, you will need to clear the Avada Fusion Builder cache after migration.
At this point in your migration, do some quality control and double-check that the migration went well. Follow these steps:
Step 1: Make sure your permalinks to your posts and pages are updated. In WordPress, go to Settings > Permalinks, and click Save (you don’t need to change anything else on this page). This makes sure all the permalinks are refreshed to match the new host since they sometimes get messed up during a migration.
Step 2: Now, check to make sure pages, posts and links are showing up and working properly. Check for missing images, broken links, and other signs that things might be broken. If you find any problems, be sure to fix them in WordPress. Some common areas to troubleshoot include:
- Contact form not sending emails after migration
- Modify control files accordingly in website builder
- PHP version differences on website source and hosting destination
- Check for remnants from previous hosts in WordPress files (for example, WP Engine and BlueHost)
Step 3: Delete the installer and archive files from the tool you used, since they can pose a security risk. Keep the local backup copy of your files and the database export, along with the original wp-config.php file in case you need to reverse the migration.
Step 4: Cancel your account with your old hosting provider so you don’t get charged twice.
Step 5: Make sure your website has SSL, CDN and Firewall configuration.
Pro tip: Update your IP in your Firewall settings after migrating to a new host.
Looking for a super easy way to migrate your WordPress site? Learn about GoDaddy’s 1-Click WordPress Migration. or check out the Hub by GoDaddy Pro for streamlined migration and backups for WordPress sites plus priority support whenever you need it.