Page being redirected from http to https (2 posts)

    Posted 7 years ago #

    Hey everyone!

    I need a little help.

    I have a wordpress install that is using a page to obtain credit card info and hence needs to be behind https.
    The form is on this page at mysite.com/form/ and I need the page to be loaded using https://mysite.com/form/

    I don't want to have a "landing" page, and then link to the secure page. The menu that link to this form page is generated automatically through wp_list_pages and thus brings in the non-https link. I figured an .htaccess rule to redirect the page, but they all end in loops since the page is redirecting to itself.

    I've tried this: (thinking I'm on the right track) but no luck.

    RewriteRule "^/billpay/water-bill(/.*)" "https://%{HTTP_HOST}$1" [R=301,L]

    I've also tried: redirect 301 /formpage/ https://www.newdomain.com/formpage/

    But that results in a loop because the page is in effect redirecting itself.

    I think the first example above is what I'm looking for, but I can't seem to get it to work.

    Please help - I'm supposed to be going live and I can't until I get this working behind ssl.

    Thanks for any help ya'll can give me!

    Posted 7 years ago #

    I've got it resolved...

    Anyone else interested, you'll need to create a conditional rewrite rule like:

    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^billpay/water-bill/(.*) https://%{HTTP_HOST}/billpay/water-bill/$1 [R=301,L]

    This will automatically rewrite the url to https as long as the page is not already an https link. This conditional keeps it from causing a loop.

    Very handy to have this capability - thus allowing you to designate any page you want to be loaded with SSL security. Even if you type it without https.


Topic Closed

This topic has been closed to new replies.

About this Topic