Tech Stuff

WordPress Migration: A Quick Guide

Two clients have moved from flat-file sites to WordPress sites this week, and I’ve moved them both. Coincidentally, both were on GoDaddy, which presents its own challenges doesn’t it. But here are the steps that worked for me in moving their ready-to-publish sites from my staging server to their production servers.

  1. Is this formula helpful? Want more? Get in touch.
    Go into phpmyadmin and export the staging site. Use the methods adequately covered elsewhere (such as here for which options to check. GoDaddy doesn’t play nicely with zip files, no matter what they imply, so just get a .sql file. Hang on to this for step 3.
  2. Copy over the whole wp-content directory from your staging site into Dropbox or a local drive. Get all your plugins, uploads and themes, along with any other files that plugins you’ve installed have put there.
  3. On the new host, create a new database. For some reason, GoDaddy applies its own special rules to MySQL, so if you use an underscore character in your database name, or the wrong kind of character in the password, you’ll need to change it.
  4. And then use the phpmyadmin “import” tab to upload the .sql script you downloaded in step 1. This will port all your settings, posts, pages and so on into a database at the new host. Later on we’ll set up the new blog to use this resource, so keep track of the database name, username and password.
  5. Open the wp_options table (or whatever you call it, hopefully you’ve changed the table prefix) and find the rows for “home,” “siteurl,” and possibly “admin_email” and update them to the new values.
  6. Take the old site files from the new production server, and move them into a backup directory. If you don’t do this, and you have an old file called “events.htm” and a new WordPress resource http://myblog.com/events, you may have problems.
  7. Run the WordPress installation script from the control panel. You’ll need to create a database, which you won’t actually use, but there’s no way around it.
  8. Copy all the files you downloaded in step 2 into the wp-content directory of the new site.
  9. Open the new wp-config.php file and make these changes:
    • DB_NAME
    • DB_USER
    • DB_PASSWORD
    • set the correct value for $table_prefix. GoDaddy doesn’t make this excellent security precaution available on their auto-installations.
    • While you’re at it, add settings such as
      define(‘DISALLOW_FILE_EDIT’, true);
      define(‘FORCE_SSL_LOGIN’, true);
      for added security
    • You’re also going to need to change the line for DB_HOST. Replace the chunk up to the first ‘.’ with the DB_NAME value.
  10. Fix all the internal links. Images and other links are going to be in the form of “http://mystagingsite.com/” instead of “http://mynewsite.com”. I like to use the “Search Regex” plugin. Install it, activate it, and find it under the Tools menu. Enter the search pattern “staging.mysite.com” and the replace pattern “www.netsite.com” and click “replace.” Study the results shown. Do they make sense? Click “search and replace.” You can then disable the plugin.

At this point, you should be good to go. You can then add other features, like security plugins, Google Analytics, or whatever else is required for final production.


Can I complain more?

GoDaddy is running PHP 5.2 by default, and one of my plugins won’t work. Fortunately, there’s an easy switch to 5.3.

Tom
Tom McGee has been building web sites since 1995, and blogging here since 2006. Currently a senior developer at Seton Hall University, he's also a freelance web programmer and musician. Contact him if you have the need for a blog, web site, redesign or custom programming!

Leave a Reply

Your email address will not be published. Required fields are marked *