title: force http to https for specific subfolders using web.config IIS
body: <p>On a VPS using Windows 2006 R2 I am wanting to edit the web.config file so that all pages found within several subfolders are redirected from http to https.</p>
  
  <p>I've found this suggestion below and what I would like to know is how to list the specific folders where this rewrite rule would then be applied.</p>
  
  <p>The subfolders are:</p>
  
  <p>/secure1/</p>
  
  <p>/secure2/</p>
  
  <p>/admin1/</p>
  
  <p>/admin2/</p>
  
  <p>Any help and advice would be greatly appreciated :)</p>
  
  <pre><code>&lt;configuration&gt;
  &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></p>