Forçar SSL per .htaccess

Per forçar la connexió HTTPS al vostre lloc web, afegiu les línies següents al fitxer .htaccess del lloc web:

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