Redirect all http to https via htaccess

First Method :-

Redirect https://www.mysite.com redirection to https://mysite.com issue
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</ifModule>

Second Method :-

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

Leave a Reply