How Do You Force Ssl And Fix Mixed Content With Htaccess 980x501

How do you force SSL and fix mixed content with HTACCESS?

So, you have a shiny new SSL certificate for your website, and now you need to force SSL, but you keep getting mixed content errors.

This simple guide will consist of two parts and should get you up and running with a “green lock” in no time.

Step 1 — You Need To Modify Your .htaccess File By Inserting The Below Code:

RewriteEngine OnRewriteCond %{HTTPS} offRewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Step 2 — Insert The Following Code Into The <meta> Section Of Your Website Header:

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

That should cover it; now your website should load with the “green lock” as well as force the loading of non-secure elements such as images to load over “https://”.

Did this solution work for you?

Leave A Comment

Vessio

Need some help?

Share a few details about your new or existing website.


    Text Us 24/7