Skip to main content
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
I need to know how to get silverstripe login session so it can work across subdomains.
For example if i logged in to : www.website.com, i need it still to be logged in when i change the url to subdomain.website.com
What i have tried is :
Add this line on sapphire/main.php :
ini_set ("session.cookie_domain", ".website.com");
But it's not working, even the Security/login is become not working(seem like no session created), please help with this, any help would be appreciated.
In order to set the session.cookie_domain, you should use the set_cookie_domain static method from Session class.
I put this in _config.php to avoid call this method in multiple pages (site entry points).
And, you should also remove the Session::start() from your code below since it is not needed.