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 setup Ansible and setup a lab of simple Ansible Playbook?

How to Setup SFTP Server in CentOS 7

Google Cloud Storage Command-line Utility [GSUTIL]