Jump to content
Larry Ullman's Book Forums

Checkout.Php Ssl And .Htaccess


Recommended Posts

Had problems with .htaccess and navigating - worked through that by rewriting the .htaccess file

 

This is what worked

RewriteEngine on

# For sales:

RewriteRule ^shop/sales/?$ sales.php

# For the primary categories:

RewriteRule ^shop/([^/]*)/$ shop.php?type=$1

# For specific products:

RewriteRule ^browse/([^/]*)/([^/]*)/([^/]*)$ browse.php?type=$1&category=$2&id=$3

 

Cart and wishlist handle perfect.

 

When I type in the code to handle https - to make sure it's not a hidden character issue I get 500 errors all the time.

 

I have an ssl certificate installed.

 

RewriteCond %{HTTPS} off

RewriteRule ^(checkout\.php(billing\.php|final\.php|admin/(.*))$ https://%(HTTP_HOST)/$1 [R=301,L]

RewriteCond %(HTTPS) off RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%(HTTP_HOST)/$1 [R=301,L]

 

If I uncomment either line I get the 500 error when loading any page.

 

Running xammp 1.7.4

PHP 5.3.5

Apache 2.2.17

Mysql 5.5.8

Link to comment
Share on other sites

To confirm, is this all on one line in your .htaccess:

RewriteCond %(HTTPS) off RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ [url="https://%(HTTP_HOST"]https://%(HTTP_HOST[/url])/$1 [R=301,L]

Because that should be two separate lines.

Link to comment
Share on other sites

Still same issue.

 

Could I get the what to add to .htaccess for just one file. The checkout.php see if I can debug that - and expand on it.

 

Other wise I will look for it myself. making ground but got stuck big time here.

 

SSL is one and I am typing the lines as they appear in the forums to avoid hidden characters

Link to comment
Share on other sites

Okay, looking more closely at what you wrote before, you have a repetition of the same two lines. So you need to fix that. Here's how you would enforce SSL for a specific file:

 


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

Also, there's a syntax error in your original code. You have another set of parentheses after "checkout.php", where it should be a | after checkout.php.

Link to comment
Share on other sites

That did it. Never could get the code for the standard redirects to work on xammp though. Even tried after I fixed everything else. But's it's working and it was a good learning experience.

Link to comment
Share on other sites

 Share

×
×
  • Create New...