Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod_rewrite eats my cookies!

6:20 pm on Jan 10, 2003 (gmt 0)

New User

10+ Year Member

joined:Jan 7, 2003
votes: 0

A classic tabloid headline, no?

I have a module which uses a temporary cookie to store the session ID.

The URL host/module/info shows me the current ID as a web page.

I use the following rules for mod_rewrite:

RewriteRule ^/info$ /module/info [PT,L]

RewriteRule ^/$ /module/info [PT,L]

If I browse to host/, I get the same session ID every time I refresh (good!)

If I browse to host/info, I get a _new_ session ID every time I refresh (not good!)

Is mod_rewrite screwing up or removing the cookie?
Or is the cookie dependent on the URL? If so, why does it work for the root path?


7:55 pm on Jan 10, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0


Probably an interaction with mod_dir. mod_dir provides the name of the index file if one is not specified in the URL, such as the case where domain.com/ is requested, and appends a trailing slash when the request contains only domain.com or domain.com/directory_name with no trailing slash. This is done with a redirect, but I'm not sure how it will interact with the agent (program or module, you didn't say) which issues your cookies.