SSL for Form

Permalink
I have an SSL certificate installed by hosting company, but can't for the life of me figure out how to make just my form page secure. Site was designed by someone else and I have been through many files but can't figure them out. When I click on the form page and then change just http to https, it puts a lot on the end of the url and works... but I had to manually do this. How can I redirect just this form page? Thanks for any help. (there are so many files and folders that I can't even find the form... but it's there.

 
plb206 replied on at Permalink Reply
Sorry... just read my note. I meant to say that it puts a LOCK on the end of the url, not "lot." :-)
jbx replied on at Permalink Reply
jbx
You can create a file inside config called site_post.php. this will run every time any page loads. Stick some simple logic in here that checks what page is being loaded and whether it should be in http or https and either continue or re-direct as applicable.

If your stuck with the logic, shout back. I do have it here somewhere... somewhere...

Jon
plb206 replied on at Permalink Reply
Jon... thanks for your reply. I have done a lot of design work but not in php. I haven't a clue. Do I need to write a "forced" ssl statement? I only want the form to be secure even though the GeoTrust certificate is installed somewhere on the site?? I paid for it and 1and1 says it is there but they can't even figure out the concrete software to help me out and neither can GeoTrust. 1and1 had me write a new .htaccess file and it made the whole site https. Then the http would not work. People would HAVE to type in the https to get to the site. I saw an earlier post about adding this to the top of the Theme file (I am not sure what file though)

if($_c->getCollectionAttributeValue('force_ssl'))
$pageLink =
'https://'.$_SERVER['HTTP_HOST'].$pageLink;
if (!$pageLink) {
$pageLink = $ni->getURL();
}

Thanks for any help. This sure should be easy but it's not. -pam-
jbx replied on at Permalink Reply
jbx
Try putting this in the site_post.php file I mentioned earlier. You will need to create this file inside /config.
<?php
if (!$_SERVER['HTTPS'] && $_SERVER['REQUEST_URI'] == '/myform') {
    header("Location:http://www.mydomain.com" . $_SERVER['REQUEST_URI']);
}
if ($_SERVER['HTTPS'] && $_SERVER['REQUEST_URI'] != '/myform'){
    header( "Location: " . BASE_URL . $_SERVER['REQUEST_URI']);
}


Replace "/myform" with the page name of your form you want to be secure.

If this still doesn't work for you, then just send me a Private Message with a link your site and your ftp details and I'll set it up for you.

Jon
plb206 replied on at Permalink Reply
Jon... I will try it but have question before I do. The website now will only work ashttp://www.myowndomainname.com;... should I replace your code with the http instead of https? Also, my form is two directories deep...http://www.mydomainname.com/contact-us/patient_registration...
Should I also replace '/myform (my own form name) with ../../myform?

Thanks again, -pam-
jbx replied on at Permalink Reply
jbx
You shouldn't need to replace the http with https. Leave it as is...

If your form is 2 levels deep, you should enter the form name as /level1/level2/myform...

Jon
plb206 replied on at Permalink Reply
okay Jon... going to try it. If not working, I will write you an email. Thanks so very much. -pam-