how can we make different urls referring to same domains work on same cookie and session
I have a website www.abc.com and i have a user for whom the url is name.abc.com. Then what is the procedu开发者_JAVA技巧re to use the same session for both the urls
To create a domain wide cookie you have to set it's domain to ".example.tld" or in your case ".abc.com". In PHP you can do this e.g. with:
ini_set('session.cookie_domain', '.abc.com');
Cookie based sessions should then be available across all subdomains.
Best wishes,
Fabian
I don't think there is a single best approach. You might want to read this SO post:
What’s your favorite cross domain cookie sharing approach?
And Googled results
In order for cookies to be shared between subdomains, the cookie domain must be .abc.com. Setting the cookie domain varies between different programming languages/frameworks.
加载中,请稍侯......
精彩评论