繁体   English   中英

htaccess https重定向3页

[英]htaccess https redirect for 3 pages

我用Google搜索并尝试了类似的操作如何将两个wordpress页面重定向到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] 

试试这个代码:

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缓存问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM