Thursday 3 December 2015

how to redirect http to https or vice versa through htaccess

To redirect the site from http to htttps just use the below code in the top of htaccess file


for htttps to http


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


for http to https 

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

 

 



No comments:

Post a Comment