RewriteEngine On RewriteCond % {HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URL} [L,R=301] code example
Example: force https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]