我想要的是将 poo.example.com
重定向到 poo.example.com/home.ashx
但我失败了以下代码;
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
<rule name="Redirect poo.example.com to poo.example.com/home.ashx" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(./)" />
<action type="Redirect" url="https://{HTTP_HOST}/home.ashx" />
</rule>
</rules>
</rewrite>
我使用的是 IIS 7.5。
注意
我厌倦了使用默认文档,但它不起作用。我的应用程序是一个 ASP.NET MVC 应用程序。它可能与此有关,但这不是这里的问题。我需要使用 IIS URL 重写功能来实现这一点。
最佳答案
您只需将 home.ashx
添加为 IIS 中的默认文档(确保它出现在列表顶部),然后就不需要进行任何 URL 重写。
关于asp.net - 重定向主页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6762866/