title: Rewriting URLs from http:// to https:// in IIS8
body: <p>Goal : I would like to redirect multiple sub domains (e.g.<a href="http://xxx.domain.com" rel="nofollow">http://xxx.domain.com</a>) to <a href="https://xxx.domain.com" rel="nofollow">https://xxx.domain.com</a></p>
  
  <p>I have the following binding in IIS</p>
  
  <p>Hostname : domain.com
  Port : 80
  Ip Address: *</p>
  
  <p>Hostname : domain.com
  Port : 443
  Ip Address: *</p>
  
  <p>I have the following rewrite rule in my web.config</p>
  
  <pre><code>  &lt;rules&gt;
      &lt;rule name="Redirect to HTTPS" stopProcessing="true"&gt;
        &lt;match url="http://(.*)" /&gt;
        &lt;conditions&gt;
          &lt;add input="{HTTPS}" pattern="^OFF$" /&gt;
        &lt;/conditions&gt;
        &lt;action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" /&gt;
      &lt;/rule&gt;
  </code></pre>
  
  <p>for some reason <a href="http://xxx.domain.com" rel="nofollow">http://xxx.domain.com</a> gives a 404 instead of being redirected.  <a href="https://xxx.domain.com" rel="nofollow">https://xxx.domain.com</a> works fine.</p>
  
  <p>Any clue why <a href="http://xxx.domain.com" rel="nofollow">http://xxx.domain.com</a> gives a 404 ?</p>