RewriteCond %{HTTPS} off [NC,OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]