2014-03-12 3 views
1

아마존 ELB (> 8080 80> 8080 443-) -> 아파치 서버 (포트 8080)아파치 리디렉션 (후행 슬래시 문제)

내 아파치 서버의/var/www/html 루트로 가지고있다./var/www/html/customer는/mnt/content/customer에 대한 심볼릭 링크입니다.

http://company.com/customer redirects to http://company.com/customer/ 
https://company.com/customer redirects to http://company.com/customer/ 

내가 원하는 : //company.com/customer/

참고 HTTP에 후행 슬래시 및 HTTPS : https://company.com/customerHTTPS로 리디렉션합니다. https에 머물고 싶습니다.

나는 내 /mnt/content/customer/.htaccess에서 다음을 시도했다 :

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteCond %{REQUEST_URI} !(.*)/$ 
RewriteRule ^(.*)$ https://company.com/$1/ [L] 

난 아직 HTTP로 리디렉션. 내 기본 파일은 index.html입니다. 나는 그물에 대해 다른 제안을 시도했지만 뭔가 빠졌습니다.

도움을 주시면 감사하겠습니다.

답변

0

당신은 당신의 첫 번째 규칙으로이 규칙을 사용할 수 있습니다 :이 일을

RewriteEngine On 

RewriteCond %{HTTPS} off [OR] 
RewriteCond %{THE_REQUEST} \s/.*?[^/][\s?] 
RewriteRule ^$ https://company.com/customer/ [R,L] 
+0

은 https://company.com//로 리디렉션됩니다. 끝의 두 개의 슬래시에 유의하십시오. https://company.com/customer/가 필요합니다. 무엇이 누락 되었습니까? – magd1

+0

수정 된 답변을 지금 사용해보십시오. – anubhava

+0

"페이지가 제대로 리디렉션되지 않습니다. Firefox가 서버가이 주소에 대한 요청을 완료되지 않는 방식으로 리디렉션 중임을 감지했습니다." – magd1

1

.

RewriteEngine On 
RewriteCond %{HTTP:X-Forwarded-Proto} !https 
RewriteRule ^/?(.*) https://%{SERVER_NAME}/customer/$1 [R,L] 

ssl이 서버가 아닌 Amazon ELB에 있었기 때문에 X-Forwarded-Proto가 필요했습니다.

도움 주셔서 감사합니다.

관련 문제