Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Get sessions login to work across subdomains

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1174 Views
  • draft
    Community Member
    57 Posts

    Get sessions login to work across subdomains Link to this post


    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.


  • jsantos81
    Community Member
    3 Posts

    Re: Get sessions login to work across subdomains Link to this post

    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.


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.