WordPress Migrations

Hey guys,

I wanted to take this time to map out some information on migrating staging word press sites over to production. These steps are important because as you start building changes to web sites in a staging environment and the proper changes have not been made you could inadvertently overwrite your production web site.

 

—===—===—===—

 

Step 1: Make sure that you have backups of the production and staging word press sites located somewhere off site. You can have these on your local desktop or laptop for now but I would recommend a NAS of some other type of filer for storage.

 

  • There are backup plugins that get installed from the word press admin panel. The one that I use and have found to work real well is called WPBackItIp. The plugin will create backups of your web site, the themes, the plugins, and anything else that is needed to make the site run. The backups will always be kept on the hosting server that the web site is currently installed on. From that server, you can download the backup files and keep a copy local.

 

  • UpDraftPlus is another great application for backing up the web site and everything needed to make it run. This plugin will allow your backups to be stored off site on most popular file storage providers. You just need to make sure that you have an account active with a storage provider such as Google Drive, Microsoft Onedrive, Rackspace Cloud, etc. I have this one configured and it even sends me an email once backups have complete and have been transferred. UpDraftPlus pulls a copy of the followings:

 

 

—===—===—===—

 

Step 2: One thing to consider here is whether you will be using the same database that is used in the staging site with the production site as well. The reason to consider this is that you will need to modify the wp-config.php file with the new database information if changing database. If you plan to use the staging database as production, then you can leave the database setting alone. Below is an example of what the settings look like before modifying for your database connection.

 

 

—===—===—===—

 

Step 3: You need to copy the content from one location to another. Make sure that what ever FTP client you are using, add the content to the correct /html folder on the server. You need to make sure that you have all of the files including the hidden files (beginning with a . i.e. .htaccess) ready to transfer. The hidden files are important to making WP sites work.

You can download a copy of the staging site to your local machine and reupload it to the new folder location or if on the same server, just copy it from one location to another. If the sites are on the same server, you can use SSH to make the copy by doing the following:

rsync -avP /domain01/html/ domain02/html

 

or

 

cp -a /domain01/html/ /domain02/html/

 

The rsync command is great for copying content because if something happens to the connection, it normally knows where it left off to continue with the copy. The cp command is the basic linux copy command to send files and folders to other locations on the server.

 

—===—===—===—

 

STEP 4: Make sure that DNS is set correctly. I would set this with a TTL of 300 or as low as it can go in order to make sure that DNS propagation takes place quickly. It is still usually common practice to give more time for propagation to occur. (24 hours) The record that needs to be changed if the site is on a different server will be the A record entry of the domain zone file. If the site is located at a different host, the A record will need to be changed along with the name server records (NS).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>