Redirect HTTP traffic to HTTPS

Recently I’ve moved all my websites to HTTPS thanks to Let’s Encrypt and Siteground.

To redirect the traffic from HTTP to HTTPS I’ve used this rule in my .htaccess¬†file:

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]