The session identifier is stored in a cookie, and the cookie may indicate how it should respond to domain names.
Take a look at the PHP setcookie documentation.
You can modify the PHP session cookie configuration with:
ini_set("session.cookie_domain", ".mydomain.com");
Nican source share