Try this:
RewriteEngine On
Match your URL with www. and rewrite to it SSL https without www.
RewriteCond %{HTTP_HOST} ^(www.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
Match your URL that does not have SSL https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…