1

I'm currently creating unique visit_id cookie in Apache with following code:

RewriteCond "%{HTTP_COOKIE}" "(^|;)\s*visit_id\s*=([A-Za-z0-9@-]+)" [NC]
RewriteRule ".?" - [CO=visit_id:%2:.www.mydomain.com:30,S=1]
RewriteRule ".?" - [CO=visit_id:%{ENV:UNIQUE_ID}:.www.mydomain.com:30]

(If cookie exists, refresh its expiration, else create cookie with value of UNIQUE_ID environment variable from mod_unique_id.)

This is working, but I would like to use more random-looking id, for example md5 of UNIQUE_ID. Is there a way to do this with just Apache configuration?

I tried %{md5:%{ENV:UNIQUE_ID}} but that doesn't work.

Markus Laire
  • 111
  • 4

0 Answers0