0

I have a website www.abc.com and i have a user for whom the url is name.abc.com. Then what is the procedure to use the same session for both the urls

Jonathan Feinberg
  • 44,698
  • 7
  • 80
  • 103
karthik
  • 11
  • 1

3 Answers3

1

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

halfdan
  • 33,545
  • 8
  • 78
  • 87
0

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

Community
  • 1
  • 1
o.k.w
  • 25,490
  • 6
  • 66
  • 63
0

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.

Jordan Ryan Moore
  • 6,877
  • 2
  • 26
  • 27