Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using .htaccess to control HTTPS on certain pages

I've got a site that requires (obviously) HTTPS for checkout. The current fix put in place involved making the whole site run in SSL mode, but this is causing problems.

How would I change this...

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]

To only set a certain URL (say basket.php) as HTTPS?

like image 637
Meep3D Avatar asked Jul 31 '09 16:07

Meep3D


2 Answers

A shorter version:

RewriteCond %{HTTPS} off
RewriteRule ^basket\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [L]
like image 168
Gumbo Avatar answered Nov 01 '22 03:11

Gumbo


I beleive this would work:

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /basket.php
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
like image 41
You Avatar answered Nov 01 '22 03:11

You