URL Rewrite http to https EXCEPT files in a specific subfolder
- by BrettRobi
I am trying to force all traffic on my web site to use HTTPS, using the URL Rewrite 2.0 module added to IIS 7.5. I got that working and now have a need to exclude a couple of pages from using SSL. So I need a rule to rewrite all URL except those referencing this folder to HTTPS. I've been banging my head against the wall on this and am hoping someone can help.
I tried creating a rule to match all URL except those in a nossl subfolder as in this example:
<rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
<match url="(/nossl/.*)" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
But this doesn't work. Can anyone help?