2010-02-17 7 views
1

나는이 질문이 몇 가지 다른 방법으로 질문되었으며 나는 여러 가지 제안을 보았고/시도했지만 어디에도 가지 않았다..htaccess에서 http와 https 사이를 전환하려면 어떻게해야합니까?

나는 http와 https가 혼합 된 사이트를 가지고 있는데, 모든 하위 디렉토리를 포함한/customer 및/cart는 모두 https이고 나머지는 http입니다. 나는 실제로 https로가는 문제가 있는데, 마치 https로 가고 바로 이걸로 http로 간다.

RewriteEngine On 

#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteRule (.*) /public.php?debug=%{SERVER_NAME} [NS,QSA,L] 

# Redirect to HTTPS if /cart or /customer 
RewriteCond %{REQUEST_URI} ^/cart.* 
RewriteCond %{REQUEST_URI} ^/customer.* 
RewriteCond %{HTTPS} !on 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R] 

# go back to regular http if not in secure area 
RewriteCond %{REQUEST_URI} !^/cart.* 
RewriteCond %{REQUEST_URI} !^/customer.* 
RewriteCond %{HTTPS} on 
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R] 

#simulate the static pages 
RewriteCond %{REQUEST_URI} ^/$ 
RewriteRule ^(.*)$ /public.php?controller=index&action=index [L] 

#Main rewrite for application/controller/action decode logic 

#RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !/scripts/ 
RewriteCond %{REQUEST_FILENAME} !/images/ 
RewriteCond %{REQUEST_FILENAME} !/css/ 
RewriteRule ^([a-z]+)\/([a-z]+)$ /public.php?controller=$1&action=$2 [QSA,L] 
RewriteRule ^([a-z]+)\/$ /public.php?controller=$1 [QSA,L] 
RewriteRule ^([a-z]+)\/([a-z]+)$ /$1/$2/ [QSA,L,R] 
RewriteRule ^([a-z]+)$ /$1/ [QSA,L,R] 

AddHandler php5-script .php 

어쩌면 누군가 나를 교정 할 수 있습니다.

TIA

답변

0

나는 당신의 문제가 생각 함께 같은 'AND'보다는한다 RewriteCond 규칙 그룹에 'OR'의 경로는 RewriteRule의 될위한 '카트'와 '고객'과 일치해야하므로 적용 (이는 의미가 없습니다). 이 시도 ..

# redirect non-https requests for /cart or /customer to https 
RewriteCond %{HTTPS} off 
RewriteRule ^(cart|customer) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

# redirect all other https requests to http 
RewriteCond %{HTTPS} on 
RewriteCond $1 !^(cart|customer) 
RewriteRule ^(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 
0

당신은, 당신의 페이지는 반 암호화되며 브라우저에서 빨간색 표시가 표시됩니다 당신은 그것이 작동되도록 경우에도 유사한 문제 htaccess (https to http)

이 질문에 모습을 가질 수 상태 표시 줄 조건에서 http 리퍼러를 사용해야합니다.

관련 문제