【发布时间】:2021-01-06 05:48:11
【问题描述】:
两个 sn-ps 都将 http 重定向到 https,但一个适用于 AWS Cloudfront 分发,而另一个不适用。就其本身而言,两者都可以正常工作。这2个sn-ps的代码有什么区别?
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^/(.*) https://example.com/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
【问题讨论】:
标签: amazon-web-services redirect mod-rewrite https amazon-cloudfront