2

I need to redirect all requests that don't come from this domain ti-passis.rhcloud.com
and use https to http to avoid certificate error.

Example:

https://ti-passis.rhcloud.com/contato (should'n be redirected)
https://tetraimoveis.com/contato (should be redirected because of certificate error, once the certificate is for "*.rhcloud.com")

RewriteCond %{HTTP_HOST} !^ti-passis.rhcloud.com$ [RC]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* http:// %{HTTP_HOST}%{REQUEST_URI} [R,L]



The RewriteCond works alone, but if I put then together, nothing works. Am I doing something wrong?

JGlass
  • 1,427
  • 2
  • 12
  • 26
pedroassis
  • 177
  • 1
  • 8

1 Answers1

0

The correct way to do it is (though you likely figured it out by now)

RewriteCond %{HTTP_HOST} !^ti-passis.rhcloud.com$ [RC,OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* http:// %{HTTP_HOST}%{REQUEST_URI} [R,L]

You're basically just "Or"ing the expression. As per JBoss "'ornext|OR' (or next condition) Use this to combine rule conditions with a local OR instead of the implicit AND."

JGlass
  • 1,427
  • 2
  • 12
  • 26