title: .htaccess redirect www to non-www with SSL/HTTPS
body: <p>I've got several domains operating under a single <code>.htaccess</code> file, each having an SSL certificate.</p>
  
  <p>I need to force a <code>https</code> prefix on every domain while also ensuring <code>www</code> versions redirect to <code>no-www</code> ones.</p>
  
  <p>Below is my code; it doesn't work:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^www.%{HTTP_HOST}
  RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI}/$1 [R=301,L]
  </code></pre>
  
  <p>What I want to achieve is to: redirect something like <code>https://www.example.com</code> to <code>https://example.com</code>.</p>
  
  <p>What am I doing wrong and how can I achieve it?</p>