Cookies And Subdomain

Setting the domain to '' or '' will make the cookie only available in the www subdomain.

If you want to make the cookie available on all subdomains of (including itself) then you'd set it to ''.

make sure the path is set to / so it works for the whole site, otherwise it might not work for sub directories on your site

  1. Using @ is not a wise act in general but using it in front of setcookie() is exceptionally unwise, if not to say a stronger word.

  2. Subdomain should be set to'

  3. path should be set, not omitted. If you want to have access to the cookie in any directory, set path to /.

  4. Nevertheless, the reason can be any. One have to debug their code, not asking for the possible reasons.