iis 7仅针对特定页面将URL重写为https [英] iis 7 rewrite url http to https only for specific page
问题描述
我有一个安装了SSL证书的购物车网站。可以使用http://或https://前缀访问所有aspx页面。但我只想显示https://前缀,如果页面名称以checkout.aspx或confirmorder.aspx结尾,整个网站应保留http://其余页面。我目前的重写是
< 规则 >
< 规则 名称 = 重定向到HTTPS 停止处理 = true >
< 匹配 url = (。*) / >
< 条件 >
< add 输入 = {URL} pattern = ^ .CheckOut\.aspx $ ignorecase < span class =code-keyword> = true / >
< add 输入 = {HTTPS} pattern = ^ OFF $ / >
< / conditions >
< action 类型 = 重定向 url = https:// {HTTP_HOST} / {R:1} redire cttype = 永久 / >
< / rule >
< / rules >
但是我也想把confirmorder.aspx放进去。当用户被重定向到checkout.aspx时,它可以正常工作,但是当我来到主页时,我仍然看到https://所以它并没有真正起作用。有人可以帮忙怎么做。
ignorecase = true / >
< add 输入 = {HTTPS} < span class =code-attribute> pattern = ^ OFF
/ >
< / conditions >
< action type = 重定向 url < span class =code-keyword> = https:// {HTTP_HOST} / {R:1} redirecttype = 永久 / >
< / rule >
< / rules >
但我也想在其中加上confirmorder.aspx。当用户被重定向到checkout.aspx时,它可以正常工作,但是当我来到主页时,我仍然看到https://所以它并没有真正起作用。有人可以帮忙怎么做。
- 学习正则表达式。它会改变你的生活。说真的。
- 如果你的工作方式符合你的要求,只需将第一个条件改为
< add 输入 = {URL} < span class =code-attribute> pattern = (CheckOut | ConfirmOrder)\ .aspx
Hi, I have a shopping cart website that has SSL certificate installed. all the aspx pages can be accessed either with http:// or https:// prefix. but I only want to show https:// prefix if the page name ends with either "checkout.aspx" or "confirmorder.aspx" and entire site should stay http:// for rest of the pages. The current rewrite I have is
<rules>
<rule name="Redirect to HTTPS" stopprocessing="true">
<match url="(.*)" />
<conditions>
<add input="{URL}" pattern="^.CheckOut\.aspx$" ignorecase="true" />
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirecttype="Permanent" />
</rule>
</rules>
but I want to put confirmorder.aspx in it as well. It works when user is redirected to checkout.aspx but when I come to home page I still see https:// so it is not really working. could someone please help how to do it.
" ignorecase="true" /> <add input="{HTTPS}" pattern="^OFF
" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirecttype="Permanent" /> </rule> </rules>
but I want to put confirmorder.aspx in it as well. It works when user is redirected to checkout.aspx but when I come to home page I still see https:// so it is not really working. could someone please help how to do it.
- Go learn Regular Expressions. It will change your life. Seriously.
- If what you have works the way you want, just change the first condition to
<add input="{URL}" pattern="(CheckOut|ConfirmOrder)\.aspx
这篇关于iis 7仅针对特定页面将URL重写为https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!