Saturday 17 August 2013

mod_rewrite cookie based on query string

mod_rewrite cookie based on query string

If a query string is detected, I want to update/set a cookie so a
particular dir is used for that browser session or until the query string
is explicitly set again.
This is what I have so far but it doesn't work as expected. Pretty sure
I'm writing the logic wrong, but not sure where.
RewriteCond %{QUERY_STRING} splittest=(A|B)
RewriteRule splittest=(A|B) [CO=splittest:$1:%{HTTP_HOST}:0:/,L]
RewriteCond %{QUERY_STRING} splittest=A [OR]
RewriteCond %{HTTP_COOKIE} splittest=A
# Split test A
RewriteRule ^(.*)$ A/$1 [L]
# Split test B
RewriteRule ^(.*)$ B/$1 [L]

No comments:

Post a Comment