Hi folks,
This question has been asked before and it also has been answered before, but the answers don't seem to work for me thus far. I'm using a dedicated sever for an application - we've got cPanel. Subdomains are being generated dynamically via htaccess, and here is the code for that:
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$ [NC]
RewriteRule ^(.*)/$ http://example.com/usergalleries/$1?subdomain=%1 [P,L]
Now, we have users who visit the site on sub1.example.com and a session gets created, which then needs to be visible on http://example.com directly. I have been unable to do it with the 3 following options:
1. Setting the session.cookie_domain to ".domain.com". No luck with this. It doesn't work when going from SUBdomain to domain. Also note that we don't have www.example.com as the main domain, just example.com.
2. Setting the value to force the session.cookie_domain via htaccess results in an internal server error
3. Using ini_set() doesn't help either.
So, I'm a little frustrated because I'm not sure what the problem is. We don't have suhosin installed, so that shouldn't be the issue.
Ideally I would like to do something at the php.ini level. Failing that, perhaps inside my script.
Finally, assuming we can get this to work at the php.ini level, if we have 2 domains, how would we accomplish putting to domains in the session.cookie_domain field in cPanel. Do we split them with a comma or semicolon or a space?
Thanks for your help!