I donโt think the domain is accessible when reading cookies, this is limited by the browser. The solution would be to delete the old cookie and change it to the new domain.
eg.
$value = $_COOKIE['TestCookie']; setcookie("TestCookie", "", time() - 3600, "www.example.com"); setcookie("TestCookie", $value, time + (60 * 60 * 24 * 30), ".example.com");
source share