2

I already have a 301 from HTTPS to HTTP sitewide. But I want to exclude checkout pages so that they are always HTTPS (located in "/shopping-cart/")

Tried this:

#RewriteCond %{SERVER_PORT} ^443$
#RewriteRule ^(.*)$ http://www.example.com$1 [R=301]

#RewriteCond %{SERVER_PORT} ^80$
#RewriteCond %{HTTP_HOST} ^www.example.com$
#RedirectRule ^/shopping-cart(.*)$ https://%{HTTP_HOST}/shopping-cart$1 [R=301]

This gives me a redirect loop when I get to /shopping-cart/ pages

OutFall
  • 482
  • 7
  • 20

1 Answers1

0

What I think is causing the loop is the sequence of the rules. Swap them and add the [l] tag to the shopping_cart rule (the [l] means "last" i.e. stop processing further rules if this rule matches)

#RewriteCond %{SERVER_PORT} ^80$
#RewriteCond %{HTTP_HOST} ^www.example.com$
#RedirectRule ^/shopping-cart(.*)$ https://%{HTTP_HOST}/shopping-cart$1 [R=301, l]

#RewriteCond %{SERVER_PORT} ^443$
#RewriteRule ^(.*)$ http://www.example.com$1 [R=301]
S.Krishna
  • 868
  • 12
  • 26