Forum Moderators: phranque
If we go to our homepage we get a cookie written as so:
username@domain
www.domain.com/ (written inside the cookie file)
But if I go directly to a page that uses mod_rewrite it looks like this:
page: www.domain.com/category/1234
cookie: username@category
www.domain.com/category (written inside the cookie)
Then when I click to go to an item: www.domain.com/item/1
It creates yet another cookie: username@item - www.domain.com/item]
Does anyone know why the cookie is not just being written as the domain?
Here are my rewrite rules:
VirtualHost *:80>
Servername www.domain.com
ServerAlias domain.com
RewriteEngine on
RewriteRule ^/item/([^/\.]+)/?$ /listitem.jsp?item=$1 [PT]
RewriteRule ^/item/([^/\.]+)/ad/([^/\.]+)/?$ /listitem.jsp?item=$1&ad=$2 [PT]
RewriteRule ^/category/([^/\.]+)/?$ /listcategories.jsp?c=$1 [PT]
RewriteRule ^/category/([^/\.]+)/ad/([^/\.]+)/?$ /listcategories.jsp?c=$1&ad=$2 [PT]
RewriteLog logs/rewrite.log
RewriteLogLevel 0
DocumentRoot /var/tomcat5/webapps/domain
JkMount /* loadbalancer
</VirtualHost>
I've looked all over, but haven't found anyone else with this problem. Any help would be greatly appreciated.
A cookie may be set for an entire site, or for only part of the URL-space within that site. Change your code to set the cookie for your entire site, if that's what you want to do.
See the original cookie specification at [wp.netscape.com...]
Jim
Cookie cookie = new Cookie("ShoppingCart", cartId);
cookie.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(cookie);
I tried cookie.setDomain(".domain.com").
Do I need to set the path?
On a side note if i go to www.domain.com/listcategories.jsp?c=1
the cookie is set username@domain
but if i go to www.domain.com/category/1
the cookie is set username@category