title: How to Redirect https://example.com/ to https://www.example.com/
body: <p>I have this code in my <code>.htaccess</code> file as shown below.</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} off 
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  </code></pre>
  
  <p>This was added to redirect http to https so the entire site is now in https version.</p>
  
  <p>Now I want to redirect from non-www to www. When I type example.com I should be redirected to <a href="https://www.example.com/" rel="nofollow">https://www.example.com/</a></p>
  
  <p>How do I do that with an <code>.htaccess</code> file?</p>