views:

381

answers:

1

Let say I have a website with domain: www.example.com

If I set a cookie with path '/' the cookie will be accessible via all pages in the domain, eg:

  • www.example.com/page1.html
  • www.example.com/subfolder1/page1.html
  • www.example.com/subfolder1/moresubfolder1/page1.html, etc.

What if we set the cookie to path '/subfolder1', will the cookie will be made available to any page or subfolder beneath the folder? Eg:

  • www.example.com/subfolder1/moresubfolder/page1.html

So, if not, I guess, I have no choice but to use path '/' for those cookies, right?

+1  A: 

If we set the cookie to path '/subfolder1', will the cookie will be made available to any page or subfolder beneath the folder?

Yes. The cookie will be available to all pages and subdirectories.

Alex Barrett