title: Too many redirects configuring HTTPS redirect on .htaccess
body: <p>I have a website with <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a>, <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a>, <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a> and <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a> working fine.</p>
  
  <p>Now I want that regardless of which one you type, it redirects to <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a>. I am using the code below in my .htaccess (and tried many more), but after doing the redirection in the browser the page doesn't load, giving error "Too many redirects". I tried of course deleting cache.</p>
  
  <pre><code>RewriteEngine On 
  RewriteCond %{SERVER_PORT} 80 
  RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
  </code></pre>