1
爲了在AWS Elastic Beanstalk php應用程序上將http重定向到https,我在.htaccess文件上使用重寫規則。在Elastic Beanstalk上強制重定向http到https
我的問題是,我的規則工作的優良指向文件的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]
感謝您的幫助!