Jabb
Jabb

Reputation: 3502

How globally redirect all https to http with 301 except for certain urls

We'd like to redirect all https to http with 301 using htaccess mod_rewrite except for certain urls that contain these substrings.

/checkout/, /customer/, /cart/

There are plenty examples for global redirects. But how can this achieved in combination with some exceptions from the rule?

Upvotes: 2

Views: 94

Answers (1)

Florian Lemaitre
Florian Lemaitre

Reputation: 5748

You can try with this file:

RewriteEngine on
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/checkout/
RewriteCond %{REQUEST_URI} !^/customer/
RewriteCond %{REQUEST_URI} !^/cart/
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Upvotes: 1

Related Questions