Redirect HTTP to HTTPS using .htaccess

 

Now you just need to add the above code at your .htaccess file for redirect http to https

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]

For Example:-

Now, when a visitor types http://www.yoursite.com/mypage.htm the server will automatically redirect http to https so that they go to https://www.yoursite.com/mypage.htm

Leave a Reply