IIS 使用(URL 重写)重定向到另一个域

IIS using (URL Rewrite) to Redirect to another domain

正在尝试从 https://www.domain.info/cms-cp/login.html 重定向到 https://www-server2.domain.info/cms-cp/login.html 通过对 (URL Rewrite) 插件使用以下代码,但不幸的是无法正常工作。

<rule name="Redirect To Web2 Server CMS"  enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
            <add input="{HTTPS}" pattern="^(www.domain.info/cms-cp/login.html)$" />
    </conditions>
    <action type="Redirect" url="https://www-server2.domain.info/cms-cp/login.html" redirectType="Permanent" /> 
</rule>
<rule name="Redirect To Server2" patternSyntax="ECMAScript"  enabled="true" stopProcessing="true">  
    <match url="login.html" />
    <conditions trackAllCaptures="false">
        <add input="{HTTP_HOST}" pattern="^www\.domain\.info$" ignoreCase="true" />
    </conditions>
    <action type="Redirect" url="https://www-server2.domain.info/cms-cp/login.html" redirectType="Permanent" />
</rule>

{HTTPS} 只是一个布尔值,用于检查 https 是否已启用。 所以你可以像这样应用规则

<rule name="Redirect To Web2 Server CMS" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^on$" />
                        <add input="{HTTP_HOST}" pattern="www\.domain\.info" />
                        <add input="{URL}" pattern="^/cms-cp/login.html$" />
                    </conditions>
                    <action type="Redirect" url="https://www-server2.domain.info/cms-cp/login.html" />
                </rule>