How to Quickly Move a WordPress Site

WordPress multisite or not, when it comes to migrating WordPress from one domain to another domain, it can get very tricky. Sure, for a single install without multi-site capabilities a migration should be as simple as moving a site’s files to a new domain and adding some directives to wp-login.php as described here. But..

  • What about updating links in posts?
  • What about changing the domain name in custom menus and footer links?
  • What about updating links in comments?
  • What if the site is being moved to a subdomain or sub-directory?

There is a better way to move WordPress and update all internal links in menus, comments, posts or anywhere else. This better way works for WPMS too. It even works with serialized data; you know, serialized data, the type of data that counts string length when it’s stored in the database and is ignored if the string length is shorter or longer than its character count. Serialized data has buggered up site migrations many times for lots of web developers.

So what is this better method?

The simplest and quickest way to move a WordPress site to a new location is this:

  1. Copy the site’s files to the site’s new server space.
  2. Delete redundant data like redirection plugin logs and security plugin logs using the WordPress dashboard then use PhpMyAdmin to repair and optimize the tables.
  3. Export the database
  4. Create a new database for the site.
  5. Import the exported database into the new database.
  6. In the new site’s server space, update wp-config.php with the new database name, database username and database password.  Using a new database — even if the migration is to a new subdomain, addon domain or sub-directory of the same server — stops the original database getting damaged in case it is needed again later.
  7. Download InterconnecIt’s Database Search and Replace script (searchreplacedb2.php).
  8. Upload the script to the site’s new server space.
  9. Unzip the script
  10. Browse to the script directory in your web browser
  11. Follow the script’s prompts.
  12. Delete the script.

It’s that simple! No need to edit any WordPress files or make any other changes to the site’s database.

More details about the WordPress database search and replace script can be found on Intercennect.It site, here.

Comments

  1. glenmcpherson says

    Nice post! Only questions – Do you think you could elaborate a little? Maybe on the exact paths that need to be changed with the Search & Replace script? And the correct settings for the database extraction in PHPMyAdmin would be awesome too… Things have changed in the new PHPMyAdmin.

Leave a Reply