httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minty <>
Subject [users@httpd] setting cookies via mod_rewrite, with path but not expires
Date Mon, 08 Aug 2005 11:42:59 GMT
I'm trying to use a RewriteRule in an htaccess file to set a cookie,
such that the path value *is* set, but the cookie expires at the end
of the browser session.  Aka, I do *not* want to explicitly set the
lifetime/expires value.

Hence I have something like:

  RewriteRule ^index.shtml$ /some/other.shtml \

(note the :: between domain and path - I'm after a null value for the
lifetime/expires field)

But this doesn't appear to work.  From looking at the source [2], I'm
concluding it just ain't possible:

  static void add_cookie(request_rec *r, char *s)
    expires = apr_strtok(NULL, ":", &tok_cntx);
    if (expires) { path = apr_strtok(NULL,":", &tok_cntx); }
    else { path = NULL; }
    cookie = apr_pstrcat(rmain->pool,
      var, "=", val,
      "; path=", (path)? path : "/",
      "; domain=", domain,
      (expires)? "; expires=" : NULL,

Anyone know if this can be done?

I realise there are other ways to get cookies set - I'm specifically
wanting to do this in a RewriteRule if possible.

[2] ~/modules/mappers/mod_rewrite.c

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message