How to redirect Drupal site from http to https?

 



Hello Guys,

Today, We are going to see, how can we redirect our Drupal Site from http to https through .htaccess file with simple three lines of code.


RewriteEngine On
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*)
https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

In cases where the HTTPS/SSL connection is ended at the load balancer and all traffic is sent to instances on port 80, the following rule works to redirect non-secure traffic.

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Ensure the mod_rewrite module is loaded.


Source: Stackoverflow

Popular posts from this blog

How to deploy NODE.JS application on Ubuntu 16.04/18.04

How to deploy Java Springboot application in Ubuntu 16.04/18.04