Redirecting a directory to HTTPS in IIS
It is often handy to be able to redirect a directory and its child pages to the HTTPS protocol rather than the usual HTTP, for instance, the back-office area of a CMS. This can easily be achieved in IIS by entering the following entry to the system.webServer > rewrite > rules section of web.config:
<rule name="Redirect /some-directory-to-protect to SSL" patternSyntax="ECMAScript" stopProcessing="true">
<match url="some-directory-to-protect.*" />
<conditions>
<add input="{HTTPS}" pattern="Off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:0}" />
</rule>