title: How to redirect http to https and www to non-www via web.config?
body: <p>I would like to use web.config to redirect all requests on my asp.net site to https:// with non-www. That is:</p>
  
  <pre><code>http://
  http://www
  https://www
  </code></pre>
  
  <p>should all go to</p>
  
  <pre><code>https://
  </code></pre>
  
  <p>So far I have this for my web.config:</p>
  
  <pre><code>&lt;system.webServer&gt;
  ...
   &lt;rewrite&gt;
     &lt;rules&gt;
       &lt;clear /&gt;
       &lt;rule name="Redirect to https" 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" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /&gt;
       &lt;/rule&gt;
     &lt;/rules&gt;
   &lt;/rewrite&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>The above snippet takes care of redirecting these two:</p>
  
  <pre><code>http://
  http://www
  </code></pre>
  
  <p>But I'm missing the last, which is:</p>
  
  <pre><code>https://www  ---&gt;  https://
  </code></pre>
  
  <p>How to do that?</p>