title: apache http to https redirected you too many times
body: <p>I have a website. I want to use https only on the page so i looked up for a code for my .htaccess and I found the following code:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
       RewriteEngine On
  
       RewriteCond %{HTTPS} off
       RewriteCond %{HTTP_HOST} ^www\.(.*)$
       RewriteRule ^(.*)$ https://%1/$1 [L,R=301]
  
       RewriteCond %{HTTPS} off
       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>After adding the code to my .htaccess I reload the page an get an error: redirected you too many times.</p>
  
  <p>After removing the code from the .htaccess I reloaded the page again. It works fine. If I reload the page with https manually it works fine too.</p>
  
  <p>So why I get the error?</p>
  
  <p>Thanks for your help!</p>