0

How can I make a valid Auth session with all subdomains including www.example.com and http://example.com addresses

Now CakePHP just broke Auth session if one is created on www., and you visit the website without www.! And vice versa.

I can't use redirect to http://www.example.com if users are comming without using www., because there will be a lot of subdomains and redirect becomes not an option.

Thanks!!!

Gediminas
  • 6,503
  • 6
  • 42
  • 57

1 Answers1

0

I'm not at my computer at the moment, but you might be able to override the session domain by adding this to your app/Config/bootstrap.php

ini_set("session.cookie_domain", ".example.com");

The CakePhp Session doesn't seem to have a configuration option to set this, but the standard php configuration should probably work.

Related questions can be found here;

CakePHP keep session from main domain across to a subdomain

PHP Sessions across sub domains

Community
  • 1
  • 1
thaJeztah
  • 25,549
  • 9
  • 64
  • 88