note 80366 deleted from ref.session by danbrown

From: Date: Sun, 20 Jul 2008 16:34:12 +0000
Subject: note 80366 deleted from ref.session by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142184@lists.php.net to get a copy of this message
Note Submitter: Drew_Benton ---- I too ran into the problem of session data being different across the site when "www" was used and not used, so here's a proposed fix if you cannot easily change your "www" access for your web site. (Note: I used $HTTP_HOST rather than $_SERVER["HTTP_HOST"] and $PHP_SELF just for ease of reading) if($HTTP_HOST == "myhost.net") header('Location: http://www.myhost.net' . $PHP_SELF); you can also use: if($HTTP_HOST == "www.myhost.net") header('Location: http://myhost.net' . $PHP_SELF); Just throw that in a PHP file and include it at the top of all your PHP pages that are accessed. This way, before sessions are even used in a script, the access path is right. I think it should work out just fine. Hope it helps anyone with similar issues.

« previous php.notes (#142184) next »