【发布时间】:2013-03-30 20:35:20
【问题描述】:
为了在 AWS Elastic Beanstalk php 应用程序上将 http 重定向到 https,我在 .htaccess 文件上使用了重写规则。
我的问题是我的规则适用于指向文件的 url,但不适用于根域,例如:
http://www.testdomain.com/index.php => redirects OK to => https://www.testdomain.com/index.php
但是
http://www.testdomain.com does not redirect to https://www.testdomain.com
我的规则:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/status$
RewriteCond %{REQUEST_URI} !^/version$
RewriteCond %{REQUEST_URI} !^/_hostmanager/
RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
感谢您的帮助!
【问题讨论】:
标签: apache .htaccess mod-rewrite https amazon-elastic-beanstalk