RewriteEngine on RewriteCond %(HTTPS) !on RewriteRule (.*) https://%(HTTP_HOST)%(REQUEST_URI)
Se hai un proxy davanti al tuo server che esegue la terminazione TLS:
RewriteCond %(HTTP:X-Forwarded-Proto) !https RewriteRule (.*) https://%(HTTP_HOST)%(REQUEST_URI)