How to Configure WordPress to Use an SSL Cert

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: or / Replace: or )
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.


Copy to Clipboard


Copy to Clipboard
By |October 30th, 2017|Security|13 Comments

About the Author:

Brian Hochstein has been in and out of the hosting and web design arena as a hobby for over 15 years and has gotten back into it seriously again since 2014. His knowledge ranges from HTML, CSS, some JavaScript and PHP to server administration, computer repair and branding.


  1. Brian Hochstein January 30, 2018 at 9:37 am - Reply

    This code was updated 30JAN18 as soon as it was brought to my attention that when using the naked to www + http to https code snippet if you were to try accessing the site via “” the redirect would result in having an extra ‘www’ in the url. I have tested the new code on my this site and it appears to be working like it should. If you find that it is not working as it should please let me know as soon as possible.

  2. Robin Bakker May 30, 2018 at 12:26 am - Reply

    Hi Brian,
    Awesome guide, now I can get rid of another plugin and make WordPress installs lighter! Maybe a couple suggestions: Step 2: Go to “Setting” -> “General” -> change the WordPress-adress (URL) + Siteadress (URL)

    Make the text bold or larger for which set is intended to do what :
    “THE FIRST SET is to redirect to https://www. And THE SECOND SET is to redirect to https..”

    Just to make it dummyproof 🙂
    Again thanks! Looking forward to implement this on other WordPress installs!

    • Brian Hochstein May 30, 2018 at 1:42 am - Reply

      @Robin Bakker – Glad you found it useful! Also, thanks for the suggestions. I’ve implemented them. 🙂

  3. Slane June 14, 2018 at 7:39 am - Reply

    Do you have an example when the Webserver is MS IIS?

    • Brian Hochstein June 15, 2018 at 9:34 pm - Reply

      Hello Slane,

      I don’t have any examples geared specifically for an IIS server. Ideally it is suggested to not run a WordPress site on a windows server as it’s not really designed for one. If you can I’d say move to a linux based host.

      If you can’t migrate to a linux server – here is a write up for how to do redirects on an IIS server:

      I’m not sure if the search and replace will work or error out. The rest should probably be the same.

  4. Donna Richards July 2, 2018 at 6:52 am - Reply

    Do I install the SSL on the staging long domain name first? Or do I go into general settings and change there first to real domain name, and then force HTTPS?

    • Brian Hochstein July 3, 2018 at 1:57 pm - Reply

      Hello Donna,

      You are talking about two different areas here. A staging area and a live production site.

      Is the live production domain name already pointed at that server or does the site need to move to the server where the domain is pointing?

      Are you wanting to take the site live right now or is it not ready yet?

      Once those two questions are answered I can better assist you with your specific use case scenario.

  5. Robin Bakker July 5, 2018 at 5:22 am - Reply

    Hi Brian, What if the site links to (so a double WWW) Any idea how I can fix this?

    • Brian Hochstein July 5, 2018 at 3:25 pm - Reply

      Hello Robin – can you show me what you have in your htaccess file?

  6. Jafar November 25, 2018 at 12:17 pm - Reply

    Hi Brian. Thanks for this blog post. I have a couple of queries to ask. I recently moved a client of mine to SG’s hosting service. His old site was plain ‘HTTP’ and I used the free Let’s Encrypt (provided by SG) to ensure the ‘HTTPS’ version.

    Steps 1 and 2: Done.

    For the 3rd step, SG has a ‘switch’ to turn on to enforce HTTPS. It says: “It forces your site to work entirely over an encrypted HTTPS connection. The redirect is performed on server level and works for any website.”

    So, that’s what I did (i.e. I switched it on). I did not insert any code in the .htaccess file. My question is: Do I still need to insert the code in the .htaccess file or SG has taken care of that via the ‘switch’?

    Step 4: Done.

    Step 5: What do I need to update in the Google search console? Also, do I need to change anything in Google Analytics?

    Also, the next time, I want to use the codes you provided. Do I need to copy the brown text as well (in the code above)?

    My apologies for the amount of questions I asked. Quite a noob at it.

    • Brian Hochstein November 25, 2018 at 1:04 pm - Reply

      #3 – I believe that switch actually injects their version of htaccess script so you are fine flipping that switch. (Just as long as you do what you did and fix the mixed content by doing the search and replace on the database.)

      #5 – you have to add the https version of the site to search console and set your preferred url. Google analytics shouldn’t even miss a beat as is.

      • Jafar November 25, 2018 at 9:22 pm - Reply

        Thanks Brian.

        Step 3: Yes, I used a plugin called Better Search Replace to fix mixed content issues. So I believe that’s taken care of.

        Step 5: Okay. I’ll have to add a new property, so I’ll do that.

        I believe all the steps above will ensure that there is no (or very minimal) effect on the SEO, because obviously don’t want to lose the backlinks received etc, correct?

        • Brian Hochstein November 25, 2018 at 10:06 pm - Reply

          Yep. You might see a drop in your analytics for a month or two, but it’ll bounce right back.

Leave A Comment