Sharing SESSION Between Multiple Subdomains |
I'm using session like bellow in my CI app on a domain (i.e. domain.com)-
PHP Code: $set['x'] = $id; Now I want to use these session variables on a subdomain (i.e. sub.domain.com). How to do that..? Is there any option in CI to do that? Thank you in advance.
(06-21-2015, 04:04 PM)webdevron Wrote: I'm using session like bellow in my CI app on a domain (i.e. domain.com)- Hi webdevron, I think you can do that in config.php Look for these entries. $config['encryption_key'] = 'encryption'; $config['sess_cookie_name'] = 'sess_cookie_name'; and make it the same to your codeigniter config.php in each of your subdomain. That will work. Thanks. (06-21-2015, 06:11 PM)jmsmontecillo Wrote:(06-21-2015, 04:04 PM)webdevron Wrote: I'm using session like bellow in my CI app on a domain (i.e. domain.com)- That's obvious (even if encryption_key is only relevant for CI2), but the important part is to set cookie_domain to the top-level domain (e.g. domain.com), which allows all its subdomains (sub1.domain.com, sub2.domain.com, etc.) to receive the cookie. (06-21-2015, 06:11 PM)jmsmontecillo Wrote:(06-21-2015, 04:04 PM)webdevron Wrote: I'm using session like bellow in my CI app on a domain (i.e. domain.com)- I'm using same config file for my domain and sub domain.. So what to do in this case? |
Welcome Guest, Not a member yet? Register Sign In |