2017-09-12 7 views
0

이 문제를 해결하는 방법을 모르겠습니다.htaccess 여러 조건을 다시 작성하십시오.

http://example.com to https://example.com 
http://example.com/any-url to https://example.com/any-url 

안되는

http://subdomain1.example.com 
http://subdomain2.example.com 
http://example.com/any-file.xml 

임 SSL을 켜기 만 내 도메인이 재

리디렉션 : 나는 HTTPS로하지만 어떤 경우에는 HTTP에서 리디렉션 할 필요가 인증, 그리고 일부 파트너 문제를 피하기 위해 리디렉션하지 않고 XML 파일을 유지하고 싶습니다.

어떤 도움이 필요합니까?

답변

0

이 재 작동합니다 :

RewriteEngine on 
RewriteCond %{HTTPS} !=on 
RewriteCond %{HTTP_HOST} example.com 
RewriteCond %{REQUEST_URI} !\.xml$ 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
0

를 귀하의 경우,이 일반 HTTP 연결을 가정 일 것에서는 포트 80 :

# If the site is plain HTTP 
RewriteCond %{SERVER_PORT} 80 
# and if the requested filename is not an XML file 
RewriteCond %{REQUEST_FILENAME} !^(.*)\.xml$ 
# and if the URL specifies the request is for the primary domain (not subdomain) 
RewriteCond %{HTTP_HOST} ^example.com$ 
# then rewrite to HTTPS 
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] 

는 올바른 도메인을 삽입하는 과정에 필요 ,하지만 작동해야합니다. 나는 그것을 내 시스템에서 테스트했고 그랬다.

관련 문제