Is it possible to use mod_rewrite to modify values in cookies based upon a condition? I am completely new to HTTP, but I have tried a thing or two. The only regex I know is Perl-style, I hope it is okay.
RewriteRule s/.[0-9][0-9][0-9]/COOKIE=MSFNODE/g;
MSFNODE
is a value in my cookie.- The thing I want to run my regex on is
SESSIONID
(also in my cookie). I'm not sure how to choose that as a target. - As the regex shows, I want to replace
.[0-9][0-9][0-9]
with my cookie value calledMSFNODE
, but only ifMSFNODE
exists!
Is COOKIE=MSFNODE
the right way to do this? Also, I only want this to happen if MSFNODE
exists — as it is now, will it just pass on through and not follow the rewrite rule if MSFNODE
doesn't exist?
I feel like even my most basic regex is flawed here.
Set-Cookie
header using mod_headers, but if you need to set this "conditionally", your options are limited unless you are on Apache 2.4 (expressions). mod_rewrite handles this just fine on all versions of Apache.