HTTP To HTTPS Redirect Using Htaccess


HTTP To HTTPS Redirect Using .Htaccess

Create .htaccess file in your public_html folder if not exists. Add following conditions in it to redirect from http to https. 

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

If Apache version is below 2 use this

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Post a Comment

0 Comments