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.

1 Answer 1

4
+50

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .