• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sessions working differently with and without WWW in url

#1
I've used the Codeigniter sessions library for user authentication.

Everything was working fine,
but i now noticed that sessions created by a page on http://mysite.com are not being recognized by pages on http://www.mysite.com

Seems like this problems has been present from the beginning. I could just notice it now.

Can someone who had the same problem and had solved it, please help me?
Reply

#2
Well... www is actually a subdomain, and your session probably has valability only for the domain. So, in the config.php you should change the name of the cookie_domain parameter from something like:

PHP Code:
$config['cookie_domain']    = 'yourdomain.com'

to:

PHP Code:
$config['cookie_domain']    = '.yourdomain.com'

(notice the dot...)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.