2013-04-08 5 views
1

AWS Elastic Beanstalk PHP 애플리케이션에서 http를 https로 리디렉션하려면 .htaccess 파일에 대한 다시 쓰기 규칙을 사용하고 있습니다.Elastic Beanstalk에서 HTTP를 https로 강제 리디렉션

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] 

내 문제는 내 규칙 예를 들어, 파일을 가리키는 URL에 있지만 루트 도메인에 잘 작동한다는 것입니다

도움 주셔서 감사합니다!

답변

1

regular expression.에는 적어도 하나의 문자가 필요합니다. 당신은 빈, URL 경로를 사용하거나 ^ 또는 ^.*$

RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 

당신은 또한 SSL 연결

RewriteCond %{HTTPS} off 
를 테스트하는 %{HTTPS}을 사용할 수 있습니다 포함한 모든를 일치 시키려면
관련 문제