Rewrite Rule for SSL on www.yourdomain.tld
From A2Wiki
SSL certificates are valid only for one specific domain. Because of this, if you set up an SSL certificate for www.yourdomain.tld, visitors to your site will often receive a security warning if they access your site at yourdomain.tld. Of course you'll want your visitors to be able to connect via SSL whether they use yourdomain.tld or www.yourdomain.tld. If you add the following to your .htaccess file, visitors to yourdomain.tld or www.yourdomain.tld will be redirected to the proper https://www.yourdomain.tld secure URL.
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
