Why is it that if I create a cookie on www.example.com and check it on example.com, the cookie doesn\'t exist there? I am planning to just use .htaccess redirec
I believe you can set the cookie at example.com (really .example.com) and it will be sent if they go to www.example.com, but not vice versa. This standard security policy is to prevent users' private data from being sent to unintended servers.
Personally, I use virtualhosts in my apache2.conf:
ServerName example.com
RedirectMatch (.*) http://www.example.com$1
... in this example, everyone trying to load e.g. http://example.com/index.html is redirected to http://www.example.com/index.html.