Simple .htaccess rule to force redirect to HTTPS / SSL
Just put these 3 lines on top of your .htaccess file.
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Redirect non-www to www version
RewriteEngine on RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Redirect www to non-www version
RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
–
Thank you for sharing. Sharing is caring.