2014-02-27 4 views
0

아래 코드로 HTTPS 리디렉션을 올바르게 사용하도록 설정했습니다. HTTPS 페이지 중 하나를 방문한 후 다른 모든 URL은 이전 HTTPS를 상속합니다. 다른 모든 페이지를 HTTP로 강제 적용하려면 어떻게합니까?htaccess를 사용하여 http를 Wordpress의 https로 리디렉션 하시겠습니까?

# BEGIN WordPress 
<IfModule mod_rewrite.c> 

RewriteEngine On 
RewriteCond %{HTTPS} !on 
RewriteCond %{REQUEST_URI} ^(/checkout|/downloads|/all-products) 
RewriteRule ^(.*)$ https://websitename.com/$1 [R,L] 

RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 

답변

1

당신은 사용할 수 있습니다

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} ^/(checkout|downloads|all-products) 
RewriteRule ^(.*)$ https://websitename.com/$1 [R=301,L,NE] 

RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !^/(checkout|downloads|all-products) 
RewriteRule ^(.*)$ http://websitename.com/$1 [R=301,L,NE] 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 
+0

감사합니다! 그러나 websitename.com/index.php로 리디렉션됩니다. 내가 잘못 구성 했습니까? – user3325858

+0

'websitename.com/index.php'로 리디렉션 된 URL은 무엇입니까? – anubhava

+0

/(checkout | downloads | all-products)는 어떤 이유로 인덱스로 리디렉션됩니다. – user3325858

관련 문제