gpt4 book ai didi

.htaccess - 使用 htaccess 从特定文件夹中删除 SSL 集成

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

我的整个站点都集成了 SSL,并放置了 htaccess 代码,以便在任何人访问我的域 URL 时重定向到 https。但我想将一个文件夹保留在重定向到 https 之外。请帮助我...下面是放置在我根目录中的 htaccess 代码,用于将所有请求重定向到 https 副本

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

谢谢

最佳答案

只需添加一个排除文件夹的条件:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/folder1
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

如果您想将 /folder1 的 SSL 请求重定向到非 SSL,则:

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

关于.htaccess - 使用 htaccess 从特定文件夹中删除 SSL 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17539114/

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