gpt4 book ai didi

.htaccess - 使用 htaccess 将 https 重定向到 http 期望一个 url

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:08:16 24 4
gpt4 key购买 nike

我试图将我的网页重定向到普通的 http,但一个特定的 url 应该重定向到 https。

我试过这个:

RewriteCond %{HTTPS} off
RewriteRule ^site-name\.html$ https://domain.com/site-name.html [L,R=301]

但是这样一来,正常的网站就可以通过http和https访问了。

也许你们可以帮助我。

最佳答案

您可以使用另一个重定向所有其他页面的 https->http:

RewriteCond %{HTTPS} on
RewriteRule !^site-name\.html$ http://domain.com%{REQUEST_URI} [NE,L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^site-name\.html$ https://domain.com%{REQUEST_URI} [NE,L,R=301]

关于.htaccess - 使用 htaccess 将 https 重定向到 http 期望一个 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27482901/

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