2

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/(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="(.*)/supply-management-system/(.*)" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}/{R:2}" appendQueryString="true" />
            </rule>

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

1

This works:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .