How to force SSL with .htaccess

You can force an HTTPS connection on your website by adding these rules in your website's .htaccess file:

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

Generic solution from https://www.siteground.com/kb/how-to-force-ssl-with-htaccess/ but need to apply on sub folders with own .htaccess files. Or move to the top of root .htaccess file