Permanent redirect from http to https in .htaccess

Share with all..

apache logo

The following redirect rules can be used in the .htaccess for permanently redirecting http to https (secure connection) in Apache with SSL.

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


RewriteEngine on
Options +FollowSymLinks
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://www.%{SERVER_NAME}%{REQUEST_URI} [L,R]

Share with all..

About Abhijit Sandhan

Loves Open Source, Blogging, Traveling, Hiking and sharing Knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *