繁体   English   中英

.htaccess将除一页外的所有HTTPS重写为HTTP

[英].htaccess rewrite all HTTPS to HTTP except one page

我希望将除一页之外的所有HTTPS都重写为HTTP。 问题是,有些页面包含查询字符串,而其他页面则包含页面路径。 只能重写包含特定查询字符串的一页。 我不能在一起:

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

您可以使用此规则将所有提到的URI重定向到https

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM