【发布时间】:2019-05-15 23:36:08
【问题描述】:
我的 .htaccess 文件中有两条规则,第一条是将 http 重定向到 https,第二条是清理 url。
是否有可能以某种方式将它们结合起来以减少对最终用户的重定向?
// http to https
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://examplename.com%{REQUEST_URI} [L,NE,R=301]
// clean url
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
【问题讨论】: