重写HTTPS页面上的URL HTTP [英] Rewrite URLs on an HTTPS page to HTTP

查看:155
本文介绍了重写HTTPS页面上的URL HTTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用IIS7的绑定功能,我添加了一个SSL证书在我的网站的根目录下的https(端口443)。然后,我需要一个特定的目录,/安全的目录/'SSL连接。 https://www.mysite.com:现在我可以明确地链接到https的地址重定向到该目录/安全目录/ 。问题在于/安全目录/是我想使用SSL唯一的目录,它包含导航链接,这是目前维持HTTPS preFIX,所以我的'家'的链接,现在定向到的 https://www.mysite.com 代替的 http://www.mysite.com

Using the 'bindings' feature of IIS7, I added an SSL certificate at the root of my website to 'https' (port 443). Then, I required an SSL connection for a specific directory, '/secure-directory/'. I can now redirect to this directory by explicitly linking to the https address: https://www.mysite.com/secure-directory/. The problem is that /secure-directory/ is the only directory I want to use SSL, and it contains navigation links which are now maintaining the https prefix, so my 'Home' link now directs to https://www.mysite.com instead of http://www.mysite.com.

什么是preserve的理想方式的HTTP preFIX在/安全目录链接/?我有IIS7 URL重写模块,所以如果有人可以共享一个出站规则,这将是多AP preciated。否则,我想知道如果我要对此完全错误的方式,或者有一个以上的重写规则更好的解决方案。谢谢你。

What is the ideal way to preserve the http prefix for links in the /secure-directory/? I have the IIS7 URL Rewrite module so if someone can share an outbound rule, that would be much appreciated. Otherwise, I would like to know if I'm going about this entirely the wrong way, or of there is a better solution than a rewrite rule. Thanks.

推荐答案

感谢您的答复。我认为实现在Global.asax和模块解决方案,但是结束了工作最适合我的需求是出站重写规则。我可以在以后的日子重温这一点,并重新评估我的情况,但现在,这是我使用的是什么(有1860口生产删除):

Thanks for the replies. I considered implementing the global.asax and module solutions, but what ended up working best for my needs was an outbound rewrite rule. I may revisit this at a later date and re-evaluate my situation, but for now, this is what I'm using (with the 1860 port removed for production):

<rule name="ForceHttpsToHttp" preCondition="ResponseIsHtml1">
    <match filterByTags="A, Img" pattern="^(?!.*javascript).*$" />
        <conditions>
            <add input="{HTTPS}" pattern="ON" />
            <add input="{SERVER_PORT}" pattern="443" />
        </conditions>
    <action type="Rewrite" value="http://{HTTP_HOST}:1860{R:0}" />
</rule>

(模式prevents重写服务器端单击事件,而(。*)将改写和打破他们)

(The pattern prevents rewriting on server-side click events, whereas (.*) would rewrite and break them)

这篇关于重写HTTPS页面上的URL HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆