title: htaccess rewrite http://example.com to http://www.example.com but https://www.example.com to https://example.com
body: <p>Using .htaccess rewrite, I'd like to have:</p>
  
  <p><code>http://example.com</code> redirect to: <code>http://www.example.com</code>
  <code>https://www.example.com</code> redirect to: <code>https://example.com</code></p>
  
  <p>Which is the best way to do this?</p>
  
  <p>I've started with:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} !^www\.
  RewriteCond %{HTTPS}s on(s)|
  RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  </code></pre>