Migrate WordPress Site To SSL

This may seem trivial to some, but I swear I have been asked this question at least 1000 times. With that said, I think it is time to answer the below question for all.

How do I convert my WordPress install to SSL?

This task, while not necessarily difficult, is not as simple as just changing the WordPress url in the admin interface. As it turns out, WordPress stores the full website url in many places in the database, so in order to convert your site to SSL you will need to update those url’s. I know there are about 20 different ways to accomplish this task, however I have been using this method for years and it works flawlessly every time. A few years back, while working on a customer data migration, I came across a useful tool on Interconnect IT’s website. This tools was called “The Serialized PHP Search and Replace Tool” but has since been renamed to “Search-Replace-DB”. This tool is awesome! There are two flavors of the tool, one that runs as a php page on your site and a command line interface tool. While I typically use the CLI version, pictured below is the GUI version. The process is as simple as filling out the form steps below. Remember though, ALWAYS backup your database FIRST. Below is a download of the Search-Replace-DB 3.1 tool by Interconnect IT. srdb-ssl
This developer/sysadmin tool carries out search/replace functions on MySQL DB’s and can handle serialized PHP Arrays and Objects. Note, delete this utility from your server after use by clicking the ‘delete me’ button. It represents a major security threat to your database if maliciously used. After completing the above task, you will want to update your WordPress config.php by adding the two entries below.

/** Force SSL for admin section. */ 
define('FORCE_SSL_ADMIN', true);

/** Force SSL for all logins. */ 
define('FORCE_SSL_LOGIN', true);

Lastly, if you would like to force all connections to your site over SSL, the following addition to your Nginx vhost config file will accomplish that task.

/** Force SSL for all connections. Place before location / */ 
if ($scheme = http) {
   return 301 https://$server_name$request_uri;
}

download-icon Search-Replace-DB 3.1 Download

Did you find this article useful? Why not share it with your friends?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.