I am trying to force HTTPS for one directory only on my site. The shopping cart page. So far I have this.
- Code: Select all
ErrorDocument 404 /404.php
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} /basket/
RewriteRule ^(.*)$ https://www.website.com/basket/$1 [R,L]
Which works great, however once a user visits the HTTPS basket page every link they view after that has HTTPS in the URL. I suppose that's because of the links are written with out the full domain name and protocol ("/webpage.html").
So now I would like to have another rule that say anyone viewing a directory or page that isn't in the /basket/ should be sent to regular HTTP.
It would be a bonus too to force http://domain.com to be rewritten to http://www.domain.com as well. Thanks a lot. Hope to get some replies in the right direction very shortly!