gpt4 book ai didi

.htaccess - 从 http 到 https - htaccess 和 URL 重写 - 重定向错误太多

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

我有一个网站,在 .htaccess 中包含以下工作代码以获取友好的 URL:

RewriteEngine On
RewriteRule ^([^_]*)_([^_]*)\.html$ /?s=scheda&id=$1&slug=$2 [L]
RewriteRule ^([^/]*)\.html$ /?s=$1 [L]

因为我安装了 SSL 证书,所以我需要更新我的 .htaccess 以将 http 内容重定向到 https。我找到这段代码:

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

然后我尝试将它添加到我的 .htaccess 中:

RewriteEngine On
RewriteRule ^([^_]*)_([^_]*)\.html$ /?s=scheda&id=$1&slug=$2 [L]
RewriteRule ^([^/]*)\.html$ /?s=$1 [L]

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

但我收到“太多重定向问题”错误。

怎么了?

非常感谢。

最佳答案

此错误表明您正在循环,我只能看到一条可以循环的规则:

RewriteRule ^([^/]*)\.html$ /?s=$1 [L]

这会将 a.html 重定向到匹配此相同规则的 ?s=a.html。

但它也不应该在 http 中工作。你能证实吗?

关于.htaccess - 从 http 到 https - htaccess 和 URL 重写 - 重定向错误太多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48224390/

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