Accessing Joomla Cookies via Sub-Domains

How to



The solution is to set the session for your whole domain and/or site. It applies if you’re trying to access the session data outside of joomla scope. For example, if your joomla site is located on and your other site on then the cookie holding the session id is not transmitted from joomla to the other site. To modify this behaviour, use session_ set_ cookie_ params before every session_start() (I don’t know joomla very well, but you should have to add only a few lines of code). Use it this way:


86400 is the lifetime of the session, set it to what you prefer (86400 is one day). ‘/’ is the path of the cookie. It means that if your joomla site is located on , the session cookie will still be sent if the user accesses .

‘’ is the domain. Note the dot at the beginning, it’s very important. It says that the session cookie will be sent on any subdomain of If you don’t put it, the cookie will be sent only for addresses starting with .

This should solve your problem, unless you are trying to access the session data from another domain. If it’s the case, leave a comment here, I’ll see if I cand find something.

Leave a Reply