gpt4 book ai didi

.htaccess - 仅一页的 HTTPS

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

我的客户要求仅在单个页面上使用 HTTPS。在站点的其余部分,简单的 HTTP。我知道这有点奇怪,但我必须这样做。通过 .htaccess 它可以是这样的:

Options +FollowSymLinks 
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

如何添加条件以跳过该安全 (https://example.com/secure/) 页面?

最佳答案

你可以这样做:

Options +FollowSymLinks 
RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule ^secure(/.*)?$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

RewriteCond %{HTTPS} on
RewriteRule !^secure(/.*?)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

关于.htaccess - 仅一页的 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22707060/

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