IIS Rewrite - Redirecting only the root of one hostname to HTTPS?

前端 未结 1 1055
粉色の甜心
粉色の甜心 2021-01-22 06:39

I\'m trying to redirect only user who enters http ://site.domain.com to https ://site.domain.com

Any other http page should not redirect to https (ex: http://site.domain

相关标签:
1条回答
  • 2021-01-22 07:17

    What is the regular expression to match the empty string for a rewrite rule?

    But I would try to stick with ^$ and try this variant:

    <rewrite>
        <rules>
            <rule name="Redirect to HTTPS" stopProcessing="false">
                <match url="^$" />
                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" url="https://{SERVER_NAME}/" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
    
    0 讨论(0)
提交回复
热议问题