I use this simple code to redirect non-www http to www https
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
It succesfully redirect http://example.com to https://www.example.com. But when I tried to access http://example.com/somefolder it did not redirected. Am I missing some syntax here? or something else?