Menu Close

Quick Guide: Migrating WordPress From One Host to Another


Quick Guide: Migrating WordPress From One Host to Another

By Vail, Sometime in 2017

This guide offers a quick outline of steps to backup a WordPress site on an old host and get it setup on a new one.

Before you begin, you need:

  1. Access to the old host cpanel and the new
  2. Access to PHPMyAdmin for the old database server and new
  3. Admin access to WordPress
  4. FTP access to both hosts
  5. An understanding of how to work with PHPMyAdmin and FTP clients.

Step 1: Optimize

Before you move the site, you want to get rid of as much junk as possible

  • Run WP-Smush or a similar image-optimizer
  • Delete any orphaned or duplicate attachments in the media library
  • Deactivate plugins that are not absolutely essential
  • Deactivate Caching and security plugins. If the old site used W3 Total Cache, you will need to manually delete leftover stuff on the server via FTP.
  • Delete inactive plugins
  • Delete inactive themes except the latest default WordPress theme (this is a failsafe incase the active theme has a problem)
  • If Akismet and Jetpack are enabled, deactivate them
  • Via PHPMyAdmin, drop any tables associated with security plugins like Wordfence or Bulletproof Security
  • Drop any tables left over from caching plugins or deleted plugins
  • Install WP-Optimize. This allows you to optimize the database and delete things like transients, pingbacks, unusued comment meta,  and revisions.
  • IF THE SITE USES LAYERS do not delete revisions or you will lose the auto-backups of your page layouts.

Step 2: Backup

  • Layers sites: export the content XML, all pages individually AND create a widget export file. These are all failsafes you’ll be glad you have if something goes wrong.
  • Export the database using WP Database Backup plugin or directly out of PHPMyAdmin. The advantage to using a plugin is you can more easily exclude tables like the commentmeta (full of askismet logs)
  • Connect to the existing site via FTP and download the entire plugins, themes and uploads directories from inside wp-content

Note: On sites with a lot of images, you might want to take the time to delete all of the auto-generated copies in the uploads directories. This is pretty tedious, but worth it if you can’t wait several hours for the download and upload of all the copies to take place.

You should now have:

  1. Database file
  2. wp-content files
  3. XML

Step 3: Install WordPress on New Host

  1. Setup the site on your new host using a subdomain or temp URL. This allows you to work with the new site while still accessing the old one.
  2. Install WordPress to that site.
  3. Connect to the new site PHPMyAdmin and locate the new database
  4. Expand it and click “Check All” and choose “With Selected> Drop Tables”. This clears out the default WordPress stuff to make way for the database you backed up.
  5. Click Import and browse to the database backup file and import it.
  6. Click on wp_options and locate the site name and site url and edit them to be the new subdomain/temp url.
  7. Using FTP, download the wp-config.php for this site and open it up on your computer.
  8. Under the DB_COLLATE line, you will see a block of stuff beginning with AUTH_KEY and ending with NONCE_SALT. Delete that block.
  9. Edit $table_prefix = 'wp_'; to reflect the correct table prefix as shown in the new server’s PHPMyAdmin where you just imported the database.

Step 4: Restore Content

Connect to the new site’s webspace via FTP and upload the contents of the backed up plugins, themes and uploads folders.

  • Do not restore/overwrite .htaccess files
  • Do not restore/overwrite the root index.php or other odd files in these folders.

Step 5: Login to WordPress and cleanup

Once the restore is done, you can login to WordPress admin at the new subdomain/temp url and check everything is good.

Step 6: Switch DNS/ Transfer Domain

Once the new site is setup and functional, you can transfer/add the domain or swap the DNS servers at the old host. I recommend putting the old site into maintenance mode before doing this (using whatever plugin you like) so you can easily tell when the propegation is complete. Once the domain is resolving to the site on the new server, update the site and home urls in the new site’s WordPress admin to the domain name.

Don’t forget to re-add email addresses or forwarders if you have transferred a domain!

Share, like, repeat