从某个页面中删除 https



我的整个网站都是安全的,但我想从某个页面中删除https。有没有办法在htaccess文件或php代码中做到这一点?

这是我当前的htacces文件。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

添加

RewriteCond %{REQUEST_URI} !/page [NC]

适用于桌面浏览器。我尝试在iPhone 7上的移动野生动物园上打开该页面,但该页面返回安全状态。

清除缓存并添加了这个,但仍然没有运气

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

提前谢谢。

您可以使用以下条件从 https 重定向中排除证书页面:

把它放在重写规则行的正上方

RewriteCond %{REQUEST_URI} !/page [NC]

如果请求的 uri 与模式匹配并且是/page,则会跳过重写规则。

我不是正则表达式专家,但可能是类似的东西?

RewriteRule ^(?!.*target)(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^(target)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

target为终点。

最新更新