Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter sessions across sub domains

I have multiple subdomains and i'm trying to use the sessions across subdomains.

http://example.com
http://subdomain.example.com

I have also set the cookie domain in config.php

$config['cookie_domain'] = ".example.com";

The session userdata and also flashdata are empty when used in the other domain. Im using the same session table as well for both CI instance

like image 760
wdphd Avatar asked Oct 02 '22 04:10

wdphd


1 Answers

From the following solution : Sharing sessions

Both the cookie_domain and cookie prefix has to be set

$config['cookie_domain'] = ".example.com";
$config['cookie_prefix'] = "example_";
like image 185
wdphd Avatar answered Oct 11 '22 13:10

wdphd