gre*_*reg 46 apache .htaccess mod-rewrite redirect amazon-web-services
我不得不更新我的.htaccess:
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Run Code Online (Sandbox Code Playgroud)
对此:
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Run Code Online (Sandbox Code Playgroud)
让它在AWS Elasic负载均衡器后面工作.
这一切似乎在AWS上运行良好,但在我的本地环境中,我陷入了重定向循环.
如何让这个设置在两种环境中正常工作?
anu*_*ava 88
要使它在两种环境中都可以使用,您可以结合以下两种条件
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
37483 次 |
| 最近记录: |