Let's Encrypt, DreamHost, and WordPress

Let’s Encrypt, DreamHost, and WordPress

DreamHost recently announced free SSL certificates through their domain hosting using Let’s Encrypt.  Until today, my site was not on a secure connection (SSL).  Even though I had intended to get my site on a secure connection, I just never got around to it until now.

What Is Let’s Encrypt?

Let’s Encrypt is free open source software that will allow you to generate and renew SSL certificates with ease.  With Let’s Encrypt, you no longer have expired warnings, certificate configurations, and no more payments!  Let’s Encrypt has been in Beta for some time now and people have been using the library to generate certificates for their site without problems.  I cannot go into the low level details of Let’s Encrypt as they are over my head.

The Big News From DreamHost

Since I host all my sites on DreamHost (affiliate linkage), I was ecstatic to hear they enabled Let’s Encrypt for their shared hosting.  Technically you could generate a free SSL key on shared hosting before, but I held off until DreamHost automated the process.  If you host your domain on DreamHost and want a secure connection, I recommend enabling the free SSL certificate.

Using SSL With WordPress

If you want to switch from http to https on your WordPress site, there is not exactly an “Easy Button”.  There are many different ways this can be done, but here is how I did it.

First.  Back up your database and Enable SSL in DreamHost.  I waited an hour for everything to “fall in place”.  Once I knew https was working for my domain, I went into my wp-config.php file and forced SSL within the wp-admin.  After saving the changes, I logged into my admin to make sure it was working correctly.

Since WordPress saves a lot of urls within the database, I needed to correct them for https.  With the WP-CLI search-replace functionality, I can replace those the old http urls with the new https urls.

Could not embed GitHub Gist bc6385e5bdd093c1247d: Not Found

Finally.  It is time to force https within the .htaccess file. This snippet will simply redirect (301) the user to the https version of the url.  Old non-https links will just be redirected to the https version.

If you need more information on using SSL with WordPress, here are a few good guides.

Published by

rfmeier

Product developer at Rainmaker Digital and runner from Hampshire, Illinois. I work with php a lot; Spending most of my time digging into source code to see how it all works. You can find me on Twitter @rfmeier.

6 thoughts on “Let’s Encrypt, DreamHost, and WordPress”

  1. Hey Ryan,

    This is a very helpful post. I did all the steps above, but didn’t get HTTPS working until I updated my WordPress Address and Site Address from the General Settings. Should that step be included in your writeup?

    1. Ah, I see. I haven’t used WP-CLI before so I did a search and replace in MySQL. I’ll have to get familiar with WP-CLI in the future.

      Thanks again!

    2. Tim,

      Search and replace in mysql can screw up serialized objects within the database. The WP-CLI command will actually un-serialize the object in PHP and replace the string if found.

      Good luck and thanks for reading.

  2. > With the WP-CLI search-replace functionality, I can replace those the old http urls with the new https urls.

    It looks like WP-CLI only works with local WP installs. Is there a way to do the same search and replace on a remote / online WP install?

    1. Why do you say it only works remotely? DreamHost has come with WP-CLI for quite a while now.

Leave a Reply

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