logo

SSL enable Drupal 8

13 Oct 2021

Redirect website to HTTPS Drupal

Published On: Wed, 10/13/2021 - 16:37

Forcely redirect the website URL to SSL

If your website is opening with both form With HTTPS and without HTTPS but you want to redirect URL to with HTTPS URL then following step you can use. I have applied this method in Drupal 8 and Drupal 9 website

If SSL enabled in your website then you can use following code in htaccess file

# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{…