htaccess https重定向3页

时间:2014-05-17 11:27:52

标签: .htaccess https

我用谷歌搜索并尝试类似的东西 How do I redirect two wordpress pages to https?

它仅适用于第一页checkout_form。其他页面未切换到https。我希望3页是https重定向。 checkout_form,bit coin和paypal,所有.php文件都是https。

RewriteEngine on 

RewriteCond %{HTTP_HOST} ^example\.com 
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

# force certain pages to be https (secure)
RewriteCond %{HTTPS} off
RewriteCond $1 ^(checkout_form|bitcoin|paypal) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

1 个答案:

答案 0 :(得分:0)

试试这段代码:

RewriteEngine on 

RewriteCond %{HTTP_HOST} ^example\.com 
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

# force certain pages to be https (secure)
RewriteCond %{HTTPS} off
RewriteRule (checkout_form|bitcoin|paypal) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC] 

确保在新浏览器中进行测试,以避免301缓存问题。