Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

migrated from serverfault.com Mar 8 '11 at 0:02

This question came from our site for professional system and network administrators.

1 Answer 1

up vote 3 down vote accepted

If anyone is curious I resolved this problem with the following syntax:

<rule name="NoSSL - folder" enabled="true" stopProcessing="true">
   <match url="^nossl/.*" />
   <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
   </conditions>
   <action type="None" />
</rule>
<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{HTTPS}" pattern="off" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
share|improve this answer
    
Brett, I was looking for this exact thing, so thanks! However it appears that this doesn't work if the user browsing the site is using anything but IE. Did you run into this and if so what was your resolution? Thanks –  user16526 Jun 25 '12 at 12:36
    
Seth, this has worked perfectly for us for over a year now. We have seen no issues with any browsers. We are running IIS 7.5 on Server 2008 R2. –  BrettRobi Jun 25 '12 at 15:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.