2012-01-10 2 views
1

최고의 다음과 같은 규칙을 작성하는 방법을 확실하지 : https://secure.domain.com htaccess로는로, HTTPS는 secure.domain.com 비 HTTPS로 리디렉션 www.domain.com

    1. 모든 보안 (HTTPS) 트래픽을 리디렉션해야을 secure.domain.com에 비보안 요청이 다른 모든 보안되지 않은 요청이 http://www.domain.com
    2. 마지막으로 이동한다 https://secure.domain.com
    3. 로 리디렉션해야 모든 www가 아닌 ​​요청은 "보안"하위 도메인을 제외하고, WWW로 리디렉션합니다.
  • 답변

    2

    도메인의 루트 폴더에있는 htaccess 파일에 다음을 추가해보세요.

    RewriteEngine on 
    RewriteBase/
    
    
    #Non-secure requests to secure.domain.com should redirect to https://secure.domain.com 
    RewriteCond %{HTTPS} off 
    RewriteCond %{HTTP_HOST} ^secure\.domain\.com$ [NC] 
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
    
    #All secure (HTTPS) traffic should redirect to https://secure.domain.com 
    RewriteCond %{HTTPS} on 
    RewriteCond %{HTTP_HOST} !^secure\.domain\.com$ [NC] 
    RewriteRule .* https://secure.domain.com%{REQUEST_URI} [L,R=301] 
    
    
    #All other non-secure requests should go to http://www.domain.com 
    #Lastly, all non-www requests should redirect to www, except the "secure" subdomain. 
    RewriteCond %{HTTPS} off 
    RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] 
    RewriteRule .* http://www.domain.com%{REQUEST_URI} [L,R=301] 
    
    +0

    뛰어난 매력을 발휘했습니다. 나는 그것을 과도하게 생각하고 있다는 것을 알았다. –

    관련 문제