Under the site-enabled www.test.com, I have multiple VirtualHost configurations. ServerName varies (eg. test1.com, test2.com, test3.com) but points only into one DocumentRoot.
I can detect which server name the user is currently in by using $_SERVER['SERVER_NAME']
. However we have a particular page which requires pointing to a specific subdomain. Enabling site-wide cookies is definitely a go for this project.
My concern thus: Is there anyway to have multiple $config['cookie_domain']
in config.php? So I can have this matching idea:
$server_name = $_SERVER['SERVER_NAME'];
if($server_name == "test1.com")
$config['cookie_domain'] = ".test1.com";
else if($server_name == "test2.com")
$config['cookie_domain'] = ".test2.com";
... // so on
I even tried adding this into config.php but no luck.