Sometimes I wish Wordpress was easier to migrate from a staging environment to the live site. There are tons of things hard-coded throughout the database with a URL that needs to be changed when you update a site's url.

There's the siteurl in the wpoptions table, the guid colum in the wpposts table, and then any images or internal links that may be in the body of a post or page with the CMS.

I've read plenty of deploy procedures, but I thing that I've gotten it down to a pretty easy process. Here's how I do it:

  1. Pull down the entire structure from the staging server to your local machine (including themes and uploaded files).

  2. Pull a SQL dump of the staging database.

  3. Make sure the new server has a database and user set up - enter these into the wp-config.php file.

  4. Upload all the files to the new server, making sure that the /wp-content/uploads/ and /wp-content/uploads/*/ directories are writeable (for future file uploads).

  5. Upload the exact copy of the database to the new server.

  6. This is where the meat and potatoes are: Run this SQL command on the new server (obviously change 'newdomain.com' & 'olddomain.com' to suit your needs):

gist#https://gist.github.com/1216796.js

Hopefully this will help you when you go to move a Wordpress site over to a new server. I wish it was easier too.

I wish it was easier too.