force website to https code example
Example 1: how to force https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Example 2: force website to https
<IfModule mod_rewrite.c>
# Below
RewriteEngine On
# Force Https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
....
</IfModule>