让我们说我想自动重写
http://anysite.com/oldlogin
到
http://anysite.com/newlogin
我应该如何配置RewriteRules.config? 我尝试过
<rule name="Redirect to new login" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="http://anysite.com/oldlogin" ignoreCase="true" />
</conditions>
<action type="Redirect" url="/newlogin" redirectType="Permanent" />
</rule>
无济于事。
答案 0 :(得分:0)
这应该可以解决问题:
<rule name="Redirect to new login" stopProcessing="true">
<match url="oldlogin"/>
<action type="Redirect" url="http://anysite.com/newlogin" appendQueryString="false"/>
</rule>
"oldlogin" 可以是任何路径,如 "profile/login" 等