note 1743 deleted from function.setcookie by sniper

From: Date: Wed, 11 Dec 2002 06:45:11 +0000
Subject: note 1743 deleted from function.setcookie by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40698@lists.php.net to get a copy of this message
If you are having trouble setting cookies because people are coming to your site with http://domain.com instead of http://www.domain.com Try this code: // what they're requesting is without the www. if (getenv("HTTP_HOST") == "domain.com") { //then Redirect them to the properly formatted url with any //document/directory strings on the end. Header("Location: http://www.domain.com" . getenv("REQUEST_URI")); } This can be put into an include file and included at the top of every page of the site in case they surf into a sub-page.

« previous php.notes (#40698) next »