title: redirecting https://domain.com to https://www.domain.com
body: <p>I've recently moved my site to HTTPS and im trying to force all http traffic to https and also to the www. version</p>
  
  <p>i.e forcing
  <a href="https://domain.com" rel="nofollow">https://domain.com</a>
  to
  <a href="https://www.domain.com" rel="nofollow">https://www.domain.com</a></p>
  
  <p>I have this in my htaccess and all http to https works, apart from the redirect from <a href="https://domain.com" rel="nofollow">https://domain.com</a> to <a href="https://www.domain.com" rel="nofollow">https://www.domain.com</a></p>
  
  <p>What am i doing wrong?</p>
  
  <pre><code>RewriteEngine  on
  RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  </code></pre>