cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution
New

Windows Hosting Exclude a Folder from web.config SSL redirect to HTTPS

I have an SSL installed on a windows hosting account and I setup my web.config to redirect all traffic to HTTPS.   Everything on that side is working but there is one folder called /NOSSL/ that I would like to exclude for the redirect to HTTPS.   So if I go to www.mydomain.com it will redirect to HTTPS://www.mydomain.com   But if I go to www.mydomain.com/NOSSL/  I would like it to stay at port 80 HTTP://www.mydomain.com/NOSSL

Been searching this for a few hours trying out different solutions out there but either I get errors or it does not work.  Hoping for a quick solution where I can exclude a folder in the SSL redirect to HTTPS in the web.config.

 

 

 

2 REPLIES 2
New
Solution

Re: Windows Hosting Exclude a Folder from web.config SSL redirect to HTTPS

Found a solution that worked.  Trick was to make sure I cleared my cache which was causing my frief during the testing.

 

<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll">
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                <add input="{REQUEST_URI}" negate="true" pattern="(.*)/FOLERNAME/(.*)" ignoreCase="true" />
            </conditions>
            <action type="Redirect" redirectType="Found" appendQueryString="true" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
 
This line added to the standard SSL Redirect will use the command negate="true" to exclude whatever is in the pattern from the redirect rule.
<add input="{REQUEST_URI}" negate="true" pattern="(.*)/FOLERNAME/(.*)" ignoreCase="true" />

Re: Windows Hosting Exclude a Folder from web.config SSL redirect to HTTPS