title: Too many redirects rewrite loop
body: <p>To redirect my visitors to https I used this rule in my web.config:</p>
  
  <pre><code>  &lt;rewrite&gt;
      &lt;rules&gt;
        &lt;clear /&gt;
          &lt;rule name="HTTP to HTTPS redirect" stopProcessing="true"&gt;
            &lt;match url="(.*)" /&gt; 
            &lt;conditions&gt;
              &lt;add input="{HTTPS}" pattern="off" ignoreCase="true" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
  </code></pre>
  
  <p>But I get errors (too many redirects) when I try to visit the website, it seems it gets stuck in a loop. </p>
  
  <p><a href="https://example.com" rel="nofollow noreferrer">https://example.com</a> and <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a> are ok. </p>
  
  <p>But these addresses result in an error:  </p>
  
  <ul>
  <li><p>example.com &amp; www.example.com </p></li>
  <li><p><a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> &amp; <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a></p></li>
  </ul>
  
  <p>Can anyone help me with this?</p>