The Quickstart Guide to Migrating a WordPress Site

Moving a WordPress site to a new host can be deceptively tricky. You follow the checklist, get it all transferred and configured, and everything looks good—until it goes live and something turns up missing or broken. The more complex your site is, the easier it is to lose a file, a plugin, or a page in the move.

This guide will help you seamlessly migrate your WordPress site to a new host, whether it’s a single blog, your company’s marketing site, or an intricate multisite setup.

1. How to Tell It’s Time to Choose a New Host

Let’s start at the beginning (rumor has it that’s a very good place to start). How do you know that your WordPress site needs a new host? It’s easy to get comfortable with what you have and overlook bad WordPress host warning signs. It’s like the laundry basket you trip over every morning at home. You could move it, but instead you adapt to it.

Sure, no host is 100% perfect 100% of the time. But if you’re experiencing any of the following, you deserve better:

  • Excessive Downtime. Your host should be able to handle your site’s day-to-day traffic and have contingency plans for spikes. Frequent random outages are not normal.

  • Slow Performance. If your site is properly configured but pages still load slowly, either your host isn’t dedicating enough resources or you’ve outgrown them. Slow performance can affect your Google rankings and turn people away from the site—you don’t have to stand for it.

  • High Infrastructure Overhead. Is your development team spending more time managing your infrastructure than actually developing? It may be time to consider a new type of WordPress website management platform.

  • Growing Pains. Your hosting capacity should increase as your business grows. With some hosts, you may be running into hardware limitations. That’s especially true if you own the hardware. The potential expense of upgrading and replacing servers is an indicator you have outgrown your current setup.

The lack of having a persistent object caching service available, such as Redis or Memcached, would be a big, yet basic, reason to switch to another hosting provider. Without this, it will be very difficult to scale at a basic level.   

—Weston Ruter, Chief Technology Officer, XWP

2. Choosing a WordPress Host

There’s no one-size-fits-all solution for WordPress hosting. Finding the right host will depend on the intersection of three main criteria:

  1. Your budget

  2. Your needs (capacity, performance, traffic)

  3. Your desired level of involvement in day-to-day admin tasks

These three criteria interact with each other. For example, a low-cost host might require you to invest more time in managing infrastructure. A host that meets your needs may come in over budget or require more DevOps than you’re looking to do. It’s all about finding the right balance.

To help you evaluate WordPress hosts, here’s a quick rundown of the basic types of hosting platforms.

Shared Hosting

In a shared setup, your site is hosted on a physical server with hundreds of other sites.

  • Pros: Generally the lowest cost option, simple to set up.

  • Cons: Frequently suffers security and performance issues.

Virtual Private Server (VPS)

This solution is a step up from shared hosting as every site is isolated on the server. But instead of a physical server your site runs on a virtual server you must maintain.

  • Pros: Better performance than shared hosting.

  • Cons: Higher cost, requires tech knowledge & IT overhead.

Dedicated Hosting

Your site is hosted on its own server/server cluster you either own or rent.

  • Pros: Highest level of control.

  • Cons: The most expensive option, you’re responsible for upgrading, maintaining, and administering the hardware.

Managed Hosting

A host runs the site on your behalf, handling infrastructure, security, and performance.

  • Pros: Freedom from managing infrastructure while enjoying the benefits of a well-administered site.

  • Cons: One of the more expensive options. Your host can control how you run the site, disallowing plugins or even dictating your site’s code.

Elastic Hosting

Your site is hosted on a distributed platform, such as a container-based architecture. That way, performance isn’t dictated by pre-configured physical or virtual servers, but resources are managed with software and quickly provisioned.

  • Pros: Time saved on IT management and monitoring, reliable, responsive performance, allows for future growth, scaling without migration or downtime.

  • Cons: Less control over the minutiae of configuration, but more control than managed hosting. More costly than shared or direct hosting, but makes up the difference and more with reduced IT overhead.

For more help choosing the right WordPress host, check out this SlideShare:

Top 3 things to look for in WP Host:

  1. An understanding of WordPress and caching is critical. There's a balance between having a dynamic site with constantly-updated information and the need to cache as much as possible for optimal performance. A good host knows how to help you find the right plan for your site.

  2. Support and Uptime SLA. If the site's down how quickly can you get knowledgeable assistance? What is their policy for downtime or an emergency issue? Are they available 24/7 or do office hours apply?

  3. What sort of security and server-side protections are in place? Do they have any resources available to help with process? Development and test environments? Git and WP-CLI integration?  

—Mason James, Founder & CEO, Valet
 

What Top Developers Say About Types of Hosting

3. How to Migrate a WordPress Site to a New Host

Once you choose the perfect host, it’s time to make the migration. Save yourself some headaches later; invest time in preparing your site for the move.

First, do some WordPress migration optimization. Think of it as spring cleaning for your site. Look for unwanted files: Find duplicates and files that no longer appear on the live site. Then clear out dead pages. If you have changed your design since the last migration, odds are you have pages that aren’t linked anywhere on the site. Get rid of any plugins or themes you aren’t using, too. Finally, fix any broken links and optimize your database.

Now you can get down to the actual migration. Here are the steps:

  1. Make Backups. Get a current copy of all your content, code, and media files. If something goes wrong, you’ll be glad you did.

  2. Upload Files. Next, you'll need to upload the WordPress codebase to your new host. Likely you will need to connect to your new host via FTP to transfer the files. Select all the files from your backup.

  3. Export the Database. With most hosts, this is a simple process. If you're not sure where to start, contact your host for help. The default settings are usually for a “quick” export in the SQL format. These settings will be fine for your purposes.

  4. Get Database Credentials from the New Host. Write down the database credentials (username, password, and database name) for your new host. Before you can transfer the site over, you may need to create a home for your WordPress installation on the new host. Depending on the host, you may have a database already created or an automated tool to set it up.

    If you're not sure how to find the database credentials, contact your host for help.

  5. Edit Your Old Configuration File. With your new database in place, you need to configure your old site to work with the new settings. Find your wp-config.php file in the locally-saved backup you created in part 1. Create a copy of the file and save it, just in case. Then open the file in a text editor. You need to change three configurations:

    1. Define (‘DB_NAME’, ‘oldname’)

    2. Define (‘DB_USER,’ ‘olduser’)

    3. Define (‘DB_Password’, ‘oldpassword’)

Replace these three values with the new information from step 4 and upload the edited wp-config.php to your new host, replacing the version uploaded in step 2.

  1. Import Your Database
    This is a simple step—it’s essentially the opposite of the export you did. Some hosts use phpMyAdmin, some have their own import tool, if you're not sure how to import your database backup to your new host, contact them for help.

  2. Replace URLs in the Database
    Once files are uploaded, make sure to search for links to images or pages on your old site that will be broken on the new domain. You can do this manually for a small site, or use a tool like Search Replace DB to automate it. A lot of hosts support WP-CLI, which has a great command for search and replace.

  3. DNS Settings
    When everything is in place, change the DNS settings of your domain to point to your new site, instead of your own IP address. This process varies by hosting company, and most have tools to automate the process. This quick DNS guide can get you started.

Follow the above steps for any simple site migration. For a multisite migration with a new domain name, the process is a little more complicated and harder to automate. You will need to edit wp-config.php to change the DOMAIN_CURRENT_SITE and PATH_CURRENT_SITE variables. Multisite has a set of tables for each site and you'll need to do the domain replacement from step 7 for each site on your network.

4. WordPress Plugins to Help with Migration

Plugins are one of the best things about WordPress. There’s a plugin for everything; naturally there are quite a few for migration. Here are five of our favorites.

  1. Duplicator: Good for creating backups, copying, and migrating

  2. VaultPress: Developed by the same company that created WordPress, VaultPress is a backup and security tool with a “Restore to a Different Site” option for migration.

  3. BackupBuddy: A premium plugin for backups which also features easy migration features.

  4. BlogVault: Service for backups and migrations. Migrate feature allows you to move all the content and files of your site to a different URL, or a different hosting service.

(Worth a mention: Although it doesn’t copy files like the solutions above, WP Migrate DB Pro is a premium plugin for single-click database copying.)

5. Troubleshooting Common Migration Errors

Even the most carefully-planned, simple migration can go awry. It4 s rare, but it does happen, whether through human or computer error. If you keep good backups, though, most of these common problems are easy to fix.

Problem: Error Establishing Database Connection

This is a simple problem with an easy solution. Likely the database name, username, or password are either not set or spelled incorrectly. Double-check these settings in your wp-config.php file.

Problem: WordPress Doesn’t Load

Sometimes known as the “White Screen of Death,” when you try to load your site you get nothing but a blank screen. Check to see if you have an index.htm or index.html file in your site’s root. If so, take them out--they load before index.php, which is required for WordPress to load.

If that’s not the issue, you likely don’t have enough memory allocated for the site to run. See if you have memory-hogging plugins you can disable, or increase the memory limit in wp-config.php.

Problem: Database Corrupted

This is a common error that sounds more dire than it actually is, especially with a recent backup. First, disable all your plugins and see if that enables the database to load correctly. If it loads without plugins, add the plugins back in one at a time to see which one is the culprit.

If you can’t even load up your dashboard, you’ll need to start by reuploading the database from your backup. Then you can use WordPress’s maintenance and repair tool to fix the problem:

  1. In wp-config.php, look for the line “/**Absolute path to the WordPress directory. */”

  2. Just above that line, add (without quotes): “Define(‘WP_ALLOW_REPAIR’, true);”

  3. Navigate to http://yoursite.com/wp-admin/maint/repair.php (replacing “yoursite” with your site name).

  4. Follow the instructions there to repair and optimize your database.

Problem: Disallowed File Permissions

Some hosts will not allow files with certain permissions. For example, “777” means anyone can read, write, and execute a file, which is not a setting most security-minded hosts allow. When you try to access files with disallowed permissions, they’ll serve up an Internal Server Error.

You will likely be able to change file permissions in your new provider’s dashboard. If not, you can change permissions for each folder using this SSH command: chmod -R 644 /location/of/folder/.

Ideally, your new host will have responsive support that can help get your site back up and running quickly.

To ensure a trouble-free migration, I've come to love the philosophy that you only pull databases down, never push up. For ecommerce this is essential as data is changing on the live site. So that means you always pull the database from live to local development, but you can never push it back up. That's a pain, but not as much as a pain as losing customer data.

This requires carefully scripting deploys. The more state of the application you can define in code instead of the database, the better. Hopefully you can write a WP CLI script to make the changes that have to go in the database. The changes that need to be made in wp-admin, make sure to write down what needs done first as a checklist.  

—Josh Pollock, Founder/Lead Developer/Space Astronaut Grade 3, Caldera Labs 
 

Support You Need From Your WordPress Host

6.  WP Migration on Pantheon

If you’re migrating a WordPress site to Pantheon, you likely won’t have to worry about most of the instructions on this page. Most hosts support the Pantheon Migrations Plugin; install it on your old site, copy and paste your new credentials, and migrate with one click. If the plugin is not available on your old host, Pantheon’s new migration wizard can automate things for you.  

Of course, you can still manually migrate to Pantheon—our team will help support you throughout the process. Check out our documentation for more detail. 

Pantheon has such a great platform for doing dev, test and staging in parallel. Staging for WordPress has been a long-standing issue, a difficult problem to solve. When I got into Pantheon’s environment, it was so natural. It really nailed that core issue for us.   

—Nathan Jacobson, Web Developer, SendGrid

Learn more about WordPress hosting on Pantheon, or learn about our migration services

Let’s get in touch

855-927-9387