1

i've a cookie named "cookiename" with value "ok", and i'm trying to make a folder work if you have that cookie

I've tryed with

RewriteEngine On
RewriteCond %{HTTP_COOKIE} !^cookiename=ok$
RewriteRule .* / [NC,L]

without success... i'm getting redirected always

any ideas?

Thanks in advance

Zuker
  • 456
  • 2
  • 6
  • 18

1 Answers1

4

Don't anchor the cookie to the start ^ or end $. This will fail if you have multiple cookies. It is safer to use the word-break delimiter \b:

RewriteCond %{HTTP_COOKIE} !\bcookiename=ok\b
TerryE
  • 10,724
  • 5
  • 26
  • 48