I have this code for forcing SSL on a website generally:
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
For debugging I use a website I found http://martinmelin.se/rewrite-rule-tester/
Using the rules you provided
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I got an error at
RewriteCond %{HTTPS} !=on
This might work for you
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R,L]
Found the above example at https://www.sslshopper.com/apache-redirect-http-to-https.html