How to Force SSL in Drupal

After purchasing & Installing the SSL certificate, you will need to force SSL usage on Drupal / WordPress.

Inside the .htaccess file, you will need to add something like this (replacing your domain name as needed):

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^domainname\.com*
RewriteRule ^(.*)$ https://www.domainname.com/$1 [L,R=301]

These rewrite conditions should be placed after the following lines:

<IfModule mod_rewrite.c >
RewriteEngine on

Author: Chathura Ariyadasa

♚Father ♚Husband ♚Innovative Technical Architect ♚ Cyber Security Strategist ♞ vCISO | vCIO ♞ Blogger & an Adrenaline junkie...