How do I redirect two wordpress pages to https?

I have an SSL certificate installed on my website and I would like to redirect two specific pages to https, e.g. http://domain.com/?page=credit and http://domain.com/?page=submit_form to https.

My web host added the following code to my .htaccess file, above the WordPress settings but it still doesn’t redirect the pages:

Read More
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]

I’m sorry I’m not too good at this. Any help I can get will be appreciated.

Thanks.

Related posts

Leave a Reply

1 comment

  1. Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

    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]