Force HTTPS using .htaccess file




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]

or

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




Soji Jacob

Location : Bangalore

You may also like...