Rewrite doesn't work (OpenCart checkout page)

Discussion in 'Apache' started by tjonnyc, Dec 24, 2010.

  1. #1
    I need to redirect one specific page of an OpenCart site to HTTPS.

    Tried the following rewrites so far, none of them work. The first 2 have no effect, and the 3rd one produces a 500 error.

    I've scoured at least 30 sites with examples, but none of them seem to work. Help please!

    If it makes any difference, the checkout template file is in a subfolder /checkout/ - if I need to place an .htaccess file there separately, I can do that too.

    All I want is: https://www.mysite.com/index.php?route=checkout/specialcheckout

    Help???

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} http://www.mysite.com/index.php?route=checkout/specialcheckout
    RewriteRule ^(.*)$ https://www.mysite.com/index.php?route=checkout/specialcheckout [R,L]

    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} ^/checkout/?.*$
    RewriteCond %{REQUEST_URI} ^/checkout/specialcheckout.*$
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} http://www.mysite.com/index.php?route=checkout/specialcheckout
    RewriteRule ^https://www.mysite.com/index.php?route=checkout/specialcheckout
     
    tjonnyc, Dec 24, 2010 IP
  2. Mr.AD

    Mr.AD Member

    Messages:
    89
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    41
    #2
    Do you want to when visitor access "http://www.mysite.com/index.php?route=checkout/specialcheckout", they will be redirected to "https://...." ?
     
    Mr.AD, Dec 24, 2010 IP
  3. tjonnyc

    tjonnyc Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Yes, that's exactly what I want to do - this is the page where customers enter their credit card info, and it should definitely be httpS.

    So, regardless of how the visitor gets to that page - through the shopping cart, or saved link, etc. - I want it to transform to httpS every time.

    Thank you in advance for any ideas.
     
    tjonnyc, Dec 26, 2010 IP
  4. Mr.AD

    Mr.AD Member

    Messages:
    89
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    41
    #4
    Add the line below in your .htaccess

    RewriteRule http://www.mysite.com/index.php?route=checkout/specialcheckout https://www.mysite.com/index.php?route=checkout/specialcheckout [R=301,L] 
    Code (markup):
    Hope that help :)
     
    Mr.AD, Dec 27, 2010 IP
  5. tjonnyc

    tjonnyc Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Nope, it didn't :(

    Still shows up as http://

    Any other ideas?
     
    tjonnyc, Dec 28, 2010 IP
  6. tjonnyc

    tjonnyc Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    Resolved... had to enable the "Use Secure URL's" in the Admin, and then clear the cache.
     
    tjonnyc, Jan 5, 2011 IP