0

I am using following rewrite rules to redirect or not on SSL.

First rule "Redirect to SSL" is working fine but second rule does not work as i required.

If domain is mysite.tv/api then it do not redirect my link to SSL(https).

<rewrite>
        <rules>
            <rule name="Redirect to SSL for login and register" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther"/>
            </rule>
            <rule name="Redirect to HTTP for APi" stopProcessing="true">
                <match url="^(?!(?:api)\$)$" />
                <conditions>
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="^(www\.)?mysite\.tv\api$" ignoreCase="true" negate="false" />
                    <add input="{HTTPS}" pattern="^ON$" />
                </conditions>
                <action type="Redirect" url="http://{HTTP_Host}/{R:0}" />
            </rule>
        </rules>
    </rewrite>
azharmalik3
  • 553
  • 8
  • 21

0 Answers0