1

First of all, i have this rule already to redirect non www to www. on the site:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

But i'd like to add another rule for shopping cart pages, to force http into https on one folder and all subsequent folders within it.

i've found this script mentioned here: How to redirect all HTTP requests to HTTPS

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}/XXX

but then it enters some kind of redirect loop.

How can i safely combine both rules into one?

Community
  • 1
  • 1
reizer
  • 241
  • 3
  • 12

1 Answers1

2

You can use:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule (shoppingcartfolder/.*) https://www.domain.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Croises
  • 18,570
  • 4
  • 30
  • 47