gpt4 book ai didi

php - 将一页重定向到 http 而不是 https

转载 作者:太空宇宙 更新时间:2023-11-03 13:00:02 25 4
gpt4 key购买 nike

我有如下所示的 .htaccess 文件,用于强制 https 访问我的所有页面。

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net
RewriteRule ^(.*)$ https://www.example.net/$1 [R,L]

它按照我的要求工作正常。现在我想为我的一个名为 demo.html 的页面排除 https我不想要它的 https。它的需要

http://example.net/demo.html 

代替

https://example.net/demo.html

最佳答案

需要为其添加RewriteCond条件。

检查下面的代码:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net
RewriteCond %{REQUEST_URI} !^/demo\.html$ [NC]
RewriteRule ^(.*)$ https://www.example.net/$1 [R,L]

关于php - 将一页重定向到 http 而不是 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54453439/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com