Migrating wordpress to a new server

I just wanted to make some notes on the process of migrating a wordpress blog from one host to another, completely different host.  Hopefully this will clear some questions up for you and help you do it right the first time.

First off, you can use the import and export tools that wordpress provides which do work, quite well, but they leave out images.  Because of this I found the best way to do a COMPLETE migration of my wordpress blog (including content and most, if not all, plugins) is to do it manually.

Instructions:

  1. Download the entire wordpress directory from the old server.
  2. Modify the wp-config.php file to reflect your new settings.
  3. Upload entire wp directory, maintaining directory structure, to the new server.
  4. Use phpMyAdmin (or other mysql database manipulation tool) to export your wordpress database.
  5. Open the exported database file (probabaly ending in .sql) in a text editor.
  6. Search for and replace any references to your old host/server address (if it has changed) with the new one.
  7. Now you need to determine the server’s path to your web root folder for each server.
    • Create a new text file and place the following in it:
      <?php echo $_SERVER[‘DOCUMENT_ROOT’]; ?>
    • Save this is path.php and upload to the root directory of both the old and new servers.
    • Access this file in your web browser and compare the two different path locations it returns.
    • Replace all instances of the old path with the new one in your database export file.
  8. Now that you have replaced all the references to the old server you may import the modified database file into the database of your new server (again, using phpmyadmin or similar program).
  9. You should now have access to your wordpress on your new server with all images and other content remaining intact as well as most plugins you have installed.

Final notes

You will likely find when you next login to the wordpress admin that there are some error messages about permissions on the wp-content directory (and sub directories) which will need to be relaxed to allow wordpress to handle any new content you upload to it.

Depending on what plugins you installed before, you may have trouble with these depending on how they function though most should work just fine.