I have a site where I've written an URL rewrite rule to direct all site.com traffic to www.site.com.

Works fine.

Now I want to add SSL to an application on a subdirectory. I've added the SSL to the site but want to redirect any traffic that goes to http://www.site.com/application/ to https://www.site.com/application

Here's what I came up with:

            <rule name="Redirect Supply Management System traffic to https" stopProcessing="true">
                <match url="(.*)/supply-management-system/(.*)" />
                    <add input="{HTTP_HOST}" pattern="(.*)/supply-management-system/(.*)" />
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}/{R:2}" appendQueryString="true" />

If I test the patterns, they all seem to be ok but when I navigate to the application via http, I don't get redirected.

Any ideas would be great, thanks!

1 Answer 1


This works:

<rule name="Redirect Supply Management System traffic to https" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="(^supply-management-system/.*)" />
        <add input="{HTTPS}" pattern="off" />
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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