Exclude subdirectory from rewrite rule in web.config
- by Clog
This question comes up often, but I can only find solutions for PHP, Apache, htaccess etc but not for web.config
I would like my pages to return in HTTP not HTTPS, except for forms within certain subdirectories. I have created the following web.config file, but how do I exclude a subdirectory called forms.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force all to HTTP" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="on" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="http://www.mysite.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Many thanks all you clever clogs.