How to Force a Website to Load over HTTPS?

Once we made sure a website is loading correctly on https protocol, it’s time to make the entire website load on https protocol.

Fixing Not Secure Warning on Organic Search Traffic.

Normally if search engines has scrolled a website without SSL (on http) then all the organic traffics will be using http, so we have to do this below step to force the website to load over https protocol / to use SSL, this will remove the Not Secure warning on Chrome / Firefox and other major browsers.

Method 1: Switching HTTPS with Website URL.

  1. Open .htaccess file in the root folder of your website or create new file as .htaccess
  2. Find the line which says RewriteEngine On in the existing .htaccess file or add the code below;
    <IfModule mod_rewrite.c>
    RewriteEngine On
    </IfModule>
  3. Now add below two lines of code just after RewriteEngine On on a new line and change the website url accordingly.
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.mysiteurl.com/$1 [R=301,L]
  4. Testing, try to access the website with http for example, http://www.mysiteurl.com and see if it redirects to https://www.mysiteurl.com

Method 2: Universal HTTPS redirect for any domain or url.

  1. Open .htaccess file in the root folder of your website or create new file as .htaccess
  2. Find the line which says RewriteEngine On in the existing .htaccess file or add the code below;
    <IfModule mod_rewrite.c>
    RewriteEngine On
    </IfModule>
  3. Now add below two lines of code just after RewriteEngine On on a new line;
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
  4. Testing, try to access the website with http for example, http://www.mysiteurl.com and see if it redirects to https://www.mysiteurl.com

Hope if helps, please feel free to get in contact if you would need advice or our service on fixing SSL on websites.