• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
language subdomains - session gets lost

#1
I have apache configured to host a single CodeIgniter project from different language subdomains. I.e., all these domains point to a single directory with a single CI codebase inside it. My code sniffs out which subdomain gets accessed and this determines which language files to load. All these domains work for the most part:
example.com
en.example.com
es.example.com
de.example.com
etc.

The problem I'm having is that if I login while visiting example.com, then my session disappears when I switch to en.example.com or any of the other subdomains. I.e., switching subdomains logs the users out. My session config values look like so:
Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = '__Host-my-session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'session_table';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

And my cookie settings are like so:
Code:
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = TRUE;
$config['cookie_httponly'] = FALSE;

Is there some simple setting I can use that will allow sessions to exist across the different subdomains? Any help would be much appreciated. I've searched every forum here for "subdomain session" and found nothing at all.
Reply

#2
'cookie_domain' = Set to .your-domain.com for site-wide cookies
$config['cookie_domain'] = '.example.com';
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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