htaccess help

Soldato
Joined
10 Sep 2003
Posts
5,019
Location
Midlands
When in my shopping cart, because my URL's are relative, when a cusomer clicks back into the catalog it goes to the page in SSL mode. This brings up errors about how the page contains unsecure images bla bla.

I'd like to make it so if the user us not in the checkout and in https, they get redirected to the http version.

For some reason, the below doesn't work - any ideas why?

Code:
# ssl redirect
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(checkout|css|images|js)
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 
Can you not just serve up your resources using a secure path? Or relative paths, that way they always inherit the appropriate security.
 
Can you not just serve up your resources using a secure path? Or relative paths, that way they always inherit the appropriate security.

That was the plan but the site contains bits of embedded code which is not accessible through https.

Code:
RewriteCond %{HTTPS} on
RewriteRule !^checkout(/|$) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


Try that?

it works on the catalog pages, but /checkout just forwards to index.php which is odd.
 
That was the plan but the site contains bits of embedded code which is not accessible through https.



it works on the catalog pages, but /checkout just forwards to index.php which is odd.

Try replacing;

Code:
RewriteCond %{HTTPS} on

with;
Code:
RewriteCond %{SERVER_PORT} !443

I don't have access to a secure site, so I can't try them myself! :(
 
Back
Top Bottom