How to Migrate WordPress from One Server to Another

Posted in Articles

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

Suppose you are doing a website redesign and got the new wordpress on your test environment server.  Now it is time to deploy to your production server to overwrite your old existing wordpress site.

Migrating wordpress is a complicated task and things can go wrong.  So the very first thing you need to do is to backup the old wordpress site (the server files and the database).  BackUpWordPress is a useful plugin for that.

Method 1: Exporting and importing the whole database.  You need to change the wp prefix on the wp-config.php file.  If on wordpress web hosts, you should keep the version of wp-config and wp-admin and wp-include that is on the host (as opposed to overwriting them).  As they may have special setup in them that optimized for their hosting.  It is best to migrate over the theme and plugin files first before doing the database.   Some plugins may disable on their own if wordpress doesn’t find the plugin files.

If you are changing the domain name from source to target destination, the URL links to images and such in the database may need to be changed.  It is not good to do a search and replace of the domain name in a text editor.  Because the database may contain “serialized data”.  You may need to do a search/replace in database by using some some tool that can handle “serialized data”.  One such tool that I use is the Database Search and Replace script.  You must have a backup of the database before performing the search/replace.  Be careful of what you search and replace.  You want to search the old domain name.  But there may be email address of the old domain name that may be found in the search that you don’t want replaced.

I generally use this method.  Here is an example scenario.

  1.  Download full zip backup of all files and database backup
  2. Upload template files to new host
  3. Upload plugin files to new host
  4. Upload uploads directory to new host
  5. Import the database to new host’s database
  6. Use tool to replace old domain name in database to new domain name. Remember to remove the database replacement script
  7. Change the wp-config on new host to match the database prefix of the uploaded database
  8. Delete any unused tables from old host.
  9. Log into wp-admin and remove any user from old host that is not needed in new host (for example WPEngine creates an wpengine user)
  10. Check plugins notices.  Sometimes a plugin license will perform checks to see if it is running on two different sites and/or on correct domain name.
  11. Flush any server-side caches
  12. Test site including any shopping carts or contact forms.

Method 2: Possibly using the WP Migrate DB

Method 3:  Exporting and importing WXR (WordPress format) XML file.  This is the export of the data only.

After the migration, check that the contact forms and plugins and all other features are working.  If ecommerce site, you need to make a real purchase and confirm that money was deducted and added to buyer and seller account appropriately.

Sometimes you have to manually transfer license keys from one plugin to another as some have schemes where they work only on one website at a time.

If site has lot of of traffic, you need to disable the contact or eCommerce forms on the original site first before the migration.  Otherwise, orders or form submission will come in during your migration.

After FTP, you need to check file permission of the uploaded folders and test if new site can upload media content.  On some wordpress hosts, there are control panel buttons to purge cache and reset folder permissions.

I would recommend hiring me or another developer such as WeMoveWP.com to help you migrate WordPress.