HTTPS URL使用IIS 7.5重写特定页面的规则 [英] HTTPS URL Rewrite Rule for Specific Page Using IIS 7.5
问题描述
我正在尝试在IIS 7.5中重写URL以重定向到单页的HTTPS。
域的其余部分应保留为HTTP。
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.
为此,我正在编辑我的Web.config文件。在下面的规则中,有人可以告诉我我在做什么
错误:
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>
以下是我的URL重写模块在IIS 7.5中的样子
Below is what my URL Rewrite module looks like in IIS 7.5
非常感谢。
推荐答案
我认为你非常接近,但你的重定向将导致无限循环。试试这个:
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>
如果您必须处理多个域,请告诉我,那么该规则将需要更复杂的重写URL。
Let me know if you have to handle multiple domains, then the rule will need more complex rewrite url.
编辑:显然我们需要重定向而不是重写:)
obviously we need Redirect not Rewrite :)
这篇关于HTTPS URL使用IIS 7.5重写特定页面的规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!