【发布时间】:2018-06-21 19:19:57
【问题描述】:
我有一个站点,在 .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]
但我收到“重定向问题过多”错误。
怎么了?
非常感谢。
【问题讨论】:
标签: .htaccess ssl redirect https url-rewriting