I've a fascinating problem.

I have to implement rewrite rules according to if your cookie can there be or otherwise. Thats simple, the below rewrite rule will see if the cookie can there be and when it's it won't redirect, equally if it's not there it'll redirect.

RewriteCond % !^.mycookie.$ [NC]

Great to date. Ok now what I wish to do is, when the cookie exists and also the value is really a specific value then I wish to redirect.

I've attempted the next combinations that we thought works but neither do:

RewriteCond %{HTTP_COOKIE} !^.*mycookie.*$ [NC] 
RewriteCond %{HTTP_COOKIE} mycookie='XX' [NC]

RewriteCond %{HTTP_COOKIE} !^.*mycookie.*$ [NC] [OR]
RewriteCond %{HTTP_COOKIE} mycookie='XX' [NC]

The guidelines for my rewrite conditions to sum up are:

  1. When the cookie can there be don't redirect unless of course the worthiness is XX by which situation stick to the redirect
  2. When the cookie isn't there redirect

Thanks ahead of time