【发布时间】:2020-08-04 08:02:20
【问题描述】:
我想将一个特定的 url 重定向到另一个服务器。以下是我的重写规则:
<rewrite>
<rules>
<rule name="mydomain" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(http|https)(://domain1\.)(example\.)(com|net)(/research)(.*)" />
<action type="Redirect" url="{R1}://{R3}{R4}/domain1research" />
</rule>
</rules>
</rewrite>
我希望如果用户键入https://domain1.example.com/research,他们应该被重定向到https://example.com/domain1research。我已经在 url(.com、.net 和查询字符串)上测试了具有多种变体的表达式,并且它始终匹配。但是当我运行该网站时,它永远不会被重定向到另一个页面。我在许多网络应用程序中都进行了 URL 重写,它们都工作正常。我无法将我的手指放在我在这里缺少的东西上。
我已在本地尝试使用 hosts 文件和 Azure 上已发布网站 (Asp.Net MVC) 中的条目,但没有任何效果。
【问题讨论】:
标签: iis url-rewriting azure-appservice