【发布时间】:2017-06-11 09:19:21
【问题描述】:
我创建了从非 www 和 www http 请求到 https 和 www 请求的重定向,这很容易。我在 .htaccess 中使用了以下规则
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1
但现在的问题是,当有人在末尾输入旧的非安全 URL(如域和 project-about.html)时,.htaccess 重定向到 https,但在末尾再次添加请求,因此域后的请求如下所示:
/project-about.htmlproject-about.html
我该如何解决?谢谢
【问题讨论】:
标签: apache .htaccess redirect https