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.
siteurl in the wp_options table, the
guid colum in the wp_posts 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:
Pull down the entire structure from the staging server to your local machine (including themes and uploaded files).
Pull a SQL dump of the staging database.
Make sure the new server has a database and user set up – enter these into the wp-config.php file.
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).
Upload the exact copy of the database to the new server.
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):
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.