如何重定向2个WordPress网页到https?(How do I redirect two wo

2019-09-28 01:24发布

我有我的网站上安装了SSL证书,我想两个特定页面,HTTPS,如重定向http://domain.com/?page=credit and http://domain.com/?page=submit_form到https。

我的虚拟主机下面的代码添加到我的.htaccess文件,上面的WordPress的设置,但它仍然没有重定向页面:

Redirect /?page=credit https://domain.com/?page=credit

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{QUERY_STRING} (^|&)p=(credit)($|&)
RewriteRule (.*) https://domain.com/?page=credit [R=301,QSA,L]

对不起,我不是在这个不太好。 任何帮助,我能得到可以理解的。

谢谢。

Answer 1:

启用了mod_rewrite并通过的.htaccess httpd.conf ,然后把这个代码在你.htaccessDOCUMENT_ROOT目录:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteCond %{QUERY_STRING} (^|&)page=(credit|submit_form)(&|$) [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} =on
RewriteCond %{QUERY_STRING} !(^|&)page=(credit|submit_form)(&|$) [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


文章来源: How do I redirect two wordpress pages to https?