ASP.Net https redirect only for certain pages RRS feed

  • Question

  • User-1391737311 posted

    A site I maintain currently has the URL Rewrite rule shown below, which redirects all http traffic to https.

    There is a requirement to only have pages that start with www.mydomain.com/test to redirect to the https equivalent. There is also the need to redirect any https requests redirect to the http where they do not match the starting URL above e.g. Any https pages that do not start with https://www.mydomain.com/testshould be redirect to http.

    I am struggling a bit with the rules for this can anyone help please?

     <rule name="http to https" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:0}" /> </rule>
    Monday, August 5, 2013 3:39 PM