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
  • 43,499
  • 6
  • 78
  • 102
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
  • 32,443
  • 8
  • 76
  • 85
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
  • 24,849
  • 6
  • 63
  • 62
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,777
  • 2
  • 25
  • 27