How to Configure WordPress to Use an SSL Cert
In today’s world EVERY site needs to be served over https. Don’t take just my word for it – take the word of one of the biggest internet companies around: Google. Take a look at their developer’s article titled: Why HTTPS Matters.
Below are the step by step instructions on what to do once the SSL certificate is installed. Got a question? Feel free to ask by posting a comment below.
Step One – Install cert. (Let’s encrypt is automatic)
Step Two – Go to “Setting” -> “General” -> change the WordPress-adress (URL) + Siteadress (URL)
Step Three – Force https via htaccess file. (Code included at bottom of this post)
Step Four – Fix mixed content issues with the plugin Better Search Replace and then uninstall the plugin. (Search: http://www.example.com or http://example.com / Replace: https://www.example.com or https://example.com )
Step Five – Update site in google and bing webmaster tools
Step Six – Sit back, relax and have a cold drink as you are done.
Down below are two sets of code. The first set is to redirect to https://www. And the second set is to redirect to https:// (if you are doing this on a live site then do NOT switch from www to naked or vise versa as it will mess with SEO)
Keep in mind that both set’s of code will work for most cases if you have a single site in your account (it’s not suggested to have more than one site per account for security reasons.) or each site within your account have their own domain name and they all follow the same rules. (i.e. all use www or all are naked domains.) If you have a special case feel free to comment below with what your environment entails and I’ll try to help as best as I can.
Additional notes – Ignore anyone saying to use a plugin like Really Simple SSL. Do it right the first time and you won’t have to worry about fixing it down the road if your site needs to scale big.