Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 :


to :


but this url:


Shouldn't redirect.

I try:

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

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

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.