I'm not super hot on htaccess but looks like currently you're telling it to redirect everything to the https://www version.
This bit:
Code:
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.domain.com/$1 [L,R=301]
Means if it's not https then redirect to the https://www.domain.com/ version of the site.
The below should redirect to https and preserve the current subdomain (I think):
Code:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
You can then add additional code to redirect to www if you want to.