CodeIgniter Forums
Session data & sub-domains - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Session data & sub-domains (/showthread.php?tid=9098)

Session data & sub-domains - El Forum - 06-11-2008

I have my domain setup so that any request sent to is handled by a dedicated server, and apache virtual host settings pass all requests to the same CI install.

My goal, is to have addresses like be handled by

Furthermore, I have my default controller ($route['default_controller']) happily detecting if actually contains a username, and calling the right controller/function to handle the request.

So here's the problem... when you login on , and then load , you're suddenly not logged in anymore. Session data isn't carrying over.

I read this thread-
and tried both:
$config['cookie_domain'] = "";
(which was the default setting), and:
$config['cookie_domain'] = "";

But in either case, the session data is being kept separately. Of course, I need this to work for an unlimited number of sub-domains (for any

Any suggestions appreciated!

Session data & sub-domains - El Forum - 06-12-2008

Along with the cookie domain change, try using DB_Session to record your session data to your database. Change the session filename config value in the config files for your domain and subdomains to something like all_sessions. I experimented with this earlier and it seemed to work fine. I'm doing something similar for authorization. All of my Khaos ACL tables were renamed to have a fixed all_ prefix.

The above should work if the data for your domain and subdomains are stored in a single database. If this is not possible (need to use multiple databases) or if some of your subdomains are located on remote servers, I may have another solution but it involves using xml-rpc.