的.htaccess重写所有HTTPS到HTTP除了一页 [英] .htaccess rewrite all HTTPS to HTTP except one page

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

问题描述

我想所有的HTTPS被改写为HTTP,除了一页。问题是,有含有查询字符串页和含有页面路径其他网页。含有一定的查询字符串只有一个页面不应该被改写。我不能在一起:

 应该改写:
的https://domain.tld/index.php ID = 1
的https://domain.tld/index.php ID = 2
[...等等...]
HTTPS://domain.tld/path/page1.html
HTTPS://domain.tld/path/page2.html
[...等等...]不应该被改写:
HTTPS://domain.tld/index.php ID = 999


解决方案

您可以使用此规则来重定向所有,但一个提到的URI HTTPS

 的RewriteCond%{} HTTPS上
!的RewriteCond%{THE_REQUEST} \\ S / +指数\\ .PHP \\ ID = 999?[&放大器; \\ s]的[NC]
重写规则^ HTTP://%{HTTP_HOST}%{REQUEST_URI} [R = 302,NE,L]

I want all HTTPS to be rewritten to HTTP except one page. The problem is, there are pages containing a query string and other pages containing a page path. Only one page containing a certain querystring should NOT be rewritten. I can't get it together:

Should be rewritten:
https://domain.tld/index.php?id=1
https://domain.tld/index.php?id=2
[...and so on...]
https://domain.tld/path/page1.html
https://domain.tld/path/page2.html
[...and so on...]

Should NOT be rewritten:
https://domain.tld/index.php?id=999

解决方案

You can use this rule to redirect all but one mentioned URI to https:

RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} !\s/+index\.php\?id=999[&\s] [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=302,NE,L]

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

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