HTTPS URL Rewrite Rule for Specific Page Using IIS 7.5

本小妞迷上赌 提交于 2019-12-06 04:42:59

问题


I am trying to get URL rewrite in IIS 7.5 to redirect to HTTPS for a "single page". The rest of the domain should remain HTTP.

To do this, I am editing my Web.config file. Can somebody tell me what I am doing wrong in the below rule:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="SpecificRedirect" stopProcessing="true">
                <match url="^register.aspx$" />
                <action type="Redirect" url="https://mail.domain.org/register.aspx" />
            </rule>
        </rules>
    </rewrite>
  </system.webServer>

Below is what my URL Rewrite module looks like in IIS 7.5

thanks much.


回答1:


I think you are very close, but your redirect will cause infinite loop. Try this:

<rule name="SpecificRedirect" stopProcessing="true">
    <match url="^register.aspx$" />
    <conditions>
        <add input="{HTTPS}" pattern="^off$" />
    </conditions>
    <action type="Redirect" url="https://mail.domain.org/register.aspx" />
</rule>

Let me know if you have to handle multiple domains, then the rule will need more complex rewrite url.

EDIT: obviously we need Redirect not Rewrite :)



来源:https://stackoverflow.com/questions/13918058/https-url-rewrite-rule-for-specific-page-using-iis-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!