It was a lot of questions how to share CI native sessions between subdomains or domain & subdomain.
Just some of them: 1, 2, 3
Everybody says that we should define $config['cookie_domain']
like this
$config['cookie_domain'] = ".example.com";
It seems to be correct answer, but... subdomain drops data on update (the value $config['sess_time_to_update'] = 300;
) on both domains. After the sess_time_to_update
is expired all data get droped.
Additional info:
i usually would do:
$config['sess_cookie_name'] = 'asd';
$config['sess_expiration'] = 0; //24hours -> 8640
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'db_table';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 3000000000;
$config['cookie_domain'] = "";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With