[英]ASP.net redirection via web.config
我是ASP.net的新手,我正尝试仅将“联系我们”页面重定向到https。 其余应保留在http。 在某种程度上,我能够做到这一点。 我的问题是,当我从“联系我们”页面单击主页时,它不会返回到http.。它仍然是https。 其他链接都很好。
以下是我的web.config的一部分。 我希望有一个人可以帮助我。 谢谢。
<rewrite>
<rules>
<rule name="root to http" patternSyntax="Wildcard" stopProcessing="true">
<match url="https://www.bpicards.com/" />
<action type="Redirect" url="http://www.bpicards.com/" redirectType="Permanent" />
</rule>
<rule name="Redirect non-www to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="bpicards.com" />
</conditions>
<action type="Redirect" url="http://www.bpicards.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="Cards-Details-54-slash" patternSyntax="Wildcard" stopProcessing="true">
<match url="Cards/Details/54/" />
<action type="Redirect" url="/Cards/" redirectType="Permanent" />
</rule>
<rule name="Cards-Details-54" patternSyntax="Wildcard" stopProcessing="true">
<match url="Cards/Details/54" />
<action type="Redirect" url="/Cards/" redirectType="Permanent" />
</rule>
<rule name="RealThrills-ItemDetails-155" patternSyntax="Wildcard" stopProcessing="true">
<match url="RealThrills/ItemDetails/155" />
<action type="Redirect" url="/RealThrills/" redirectType="Permanent" />
</rule>
<rule name="Contact Us" patternSyntax="Wildcard" stopProcessing="true">
<match url="ContactUs" />
<action type="Redirect" url="https://www.bpicards.com/ContactUs/" redirectType="Permanent" />
</rule>
<rule name="Cards" patternSyntax="Wildcard" stopProcessing="true">
<match url="Cards" />
<action type="Redirect" url="http://www.bpicards.com/Cards/" redirectType="Permanent" />
</rule>
<rule name="Real Thrills" patternSyntax="Wildcard" stopProcessing="true">
<match url="RealThrills" />
<action type="Redirect" url="http://www.bpicards.com/RealThrills/" redirectType="Permanent" />
</rule>
<rule name="BPI Buys" patternSyntax="Wildcard" stopProcessing="true">
<match url="BpiBuys" />
<action type="Redirect" url="http://www.bpicards.com/Bpibuys/" redirectType="Permanent" />
</rule>
<rule name="Sip" patternSyntax="Wildcard" stopProcessing="true">
<match url="Sip" />
<action type="Redirect" url="http://www.bpicards.com/Sip/" redirectType="Permanent" />
</rule>
<rule name="Calculators" patternSyntax="Wildcard" stopProcessing="true">
<match url="Calculators" />
<action type="Redirect" url="http://www.bpicards.com/Calculators/" redirectType="Permanent" />
</rule>
<rule name="ApplyNow" patternSyntax="Wildcard" stopProcessing="true">
<match url="ApplyNow" />
<action type="Redirect" url="http://www.bpicards.com/ApplyNow/" redirectType="Permanent" />
</rule>
<rule name="BPI Cards" patternSyntax="Wildcard" stopProcessing="true">
<match url="BpiCards" />
<action type="Redirect" url="http://www.bpicards.com/BpiCards/" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
您将需要安装并启用IIS7的URL重写模块,并在web.config文件中使用重定向规则。
您可能需要检查此链接以获取一些示例代码。
http://forums.iis.net/t/1206943.aspx?HTTPS+to+HTTP+redirect+in+web+config
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.