Redirect from HTTP to HTTPS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepaks85
    New Member
    • Aug 2006
    • 114

    Redirect from HTTP to HTTPS

    Dear Friends,

    I may take your little bit time to teach me on Credit card information encryption. I know it can be done through SSL certificate. I am very new to SSL Certificate which I need to implement in our website. The SSL certificate is already installed in our hosting web server. I have made a web form in which user will enter his/her credit card information and will be encrypted through ssl certificate in our web server.

    I spoke to our web server tech support people and I was told by them that I need to redirect my page from http to https.

    for your reference here is the URL:
    Highlights of India & Nepal

    On the navigation menu Click on 'BOOK NOW' tab. Right now we are getting all the information into our email address.

    I don't have any idea about:
    1. What does this mean to redirect from http to https?
    2. How to do it?
    Can anyone please help me in this and explain?

    Thanks in advance
    Deepak
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    HTTP is the protocol used. You will notice at the beginning of every URL there is usually 'http://'. To make use of your SSL certificate, the protocol needs to be set to 'https://'. So, bearing that in mind, if you have pages on your site that need to be encrypted, make sure to link to it using 'https://yoursite.com'.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Now I see that you want to redirect to https from http.

      You can use $_SERVER['HTTPS'] and check whether it is set to 'on', if it is, then the user is already browsing with https. Otherwise, you can redirect to the same location, but using https as the prefix to the url.

      Code:
      <?php
      
      if ( $_SERVER['HTTPS'] != 'on' )
      {
          header ( "Location: https://" . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
      }
      
      ?>

      Comment

      • deepaks85
        New Member
        • Aug 2006
        • 114

        #4
        Redirect from HTTP to HTTPS

        Hi Markus,

        Thanks for your reply. But still I am confused.

        I have two pages one is html pages where form is being created and another is php page where the php script is being written.

        I don't know in which page I need to use HTTPS (while opening html page or while sending information to php page)

        Please help me.

        Here is the php script of the html form:

        Code:
         
        <?php
          $iata = $_POST['iata_number'];
          $agency = $_POST['agencyName'];
          $agencyadd = $_POST['agencyAddress1'];
          $agencyadd2 = $_POST['agencyAddress2'];
          $agencyCity = $_POST['agencyCity'];
          $agencyState = $_POST['agencyState'];
          $PostalCode = $_POST['agencyPostalCode'];
          $country = $_POST['agencyCountry'];
          $mainPhone = $_POST['mainPhone'];
          $mainFax = $_POST['mainFax'];
          $website = $_POST['website'] ;
          $consortia = $_POST['consortia'];
          $username = $_POST['username'];
          $password =  $_POST['password'];
          $rePassword =  $_POST['rePassword'];
          $email =  $_POST['email'];
          $titleID =  $_POST['titleID'];
          $firstName =  $_POST['firstName'];
          $middleInitial =  $_POST['middleInitial'];
          $lastName =  $_POST['lastName'];
          $address1 =  $_POST['address1'];
          $address2 =  $_POST['address2'];
          $city =  $_POST['city'];
          $state =  $_POST['state'];
          $postalCode =  $_POST['postalCode'];
          $country =  $_POST['country'];
          $workPhone =  $_POST['workPhone'];
          $workPhoneExt =  $_POST['workPhoneExt'];
          $homeBasedAgent =  $_POST['homeBasedAgent'];
          $cardtype = $_POST['cardtype'];
          $cardnumber = $_POST['cardnumber'];
          $cvv = $_POST['cvv'];
          $expmonth = $_POST['expmonth'];
          $expyear = $_POST['expyear'];
          $todayis = date("l, F j, Y, g:i a") ;
         
           $message="$todayis [PST] \n
         
         
          ARC/CLIA/IATA : $iata \n
          Agency Name: $agency \n
          Agency Address: $agencyadd \n
          Agency Address2: $agencyadd2 \n
          Agency City: $agencyCity \n
          Agency State: $agencyState \n
          Postal Code: $PostalCode \n
          Country: $country \n
          Main Phone: $mainPhone \n
          Main Fax: $mainFax \n
          Website: $website \n
          Primary Consortia: $consortia \n\n
         
          User Information \n\n
         
          Username: $username \n
          Password: $password \n
          Re-Password: $rePassword \n
          Email: $email \n
          Title: $titleID \n
          First Name: $firstName \n
          Middle Name: $middleInitial \n
          Last Name: $lastName \n
          Address1: $address1 \n
          Address2: $address2 \n
          City: $city \n
          State: $state \n
          Postal Code: $postalCode \n
          Country: $country \n
          Work Phone: $workPhone \n
          Work Phone Extension: $workPhoneExt \n
          Home Base Agent: $homeBasedAgent \n
          Card Type: $cardtype \n
          Card Number: $cardnumber \n
          CVV Number: $cvv \n
          Expiry Date: $expmonth , $expyear \n";
         
         
         
         
          //mail( "[EMAIL="deepaks@onlineres.com"]deepaks@onlineres.com[/EMAIL]", "Form Submission from Brochure Requests at sitatours.com", "Massage: $message",  "From: $email" );
          mail( "[EMAIL="siteupdate@onlineres.com"]siteupdate@onlineres.com[/EMAIL]", "Book Now Requests at sitatours.com", "Message: $message",  "From: $email" );
         
         
          header( "Location: [URL]http://www.sitatours.com/thankyou.html[/URL]" );
        ?>
        and here is the html form



        Thanks

        Deepak

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          You should use it on all of your pages.

          Comment

          Working...