4

I want to redirect any URL that is Https and hasn't start with "system_" to the same URL with http.

for exapmle for this url :

https://exsite.tld/some/thing/that/not/start/with/pattern

to :

http://exsite.tld/some/thing/that/not/start/with/pattern

but this url:

https://exsite.tld/system_aas3f4

Shouldn't redirect.

I try:

  RedirectMatch  ^/?((?!(system_)).*)  http://exsite.tld/$1

but it won't work. I don't know what's the problem.

Arash Mousavi
  • 658
  • 3
  • 8
  • 21

1 Answers1

4

Use rewrite instead. Try something like

RewriteEngine on
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} !^/system_
RewriteRule ^/(.*) http://exsite.tld/$1 [R=301,L]

ought to do it. Please test it before implementing in live environment.

What these rules state is: 1. enable rewrite engine, 2. check if HTTPS is on, 3. check if the URI path does not start with system_. If both the above two conditions are true, do the rewrite to http version of your domain for all remaining URIs.

KM.
  • 1,746
  • 2
  • 18
  • 31