note 72108 added to ref.url
| From: | orijing at gmail dot com | Date: | Wed, 03 Jan 2007 05:43:19 +0000 |
| Subject: | note 72108 added to ref.url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121224@lists.php.net to get a copy of this message | ||
In response to Joe, I decided to force my users to use the no-www version of http://originxt.com (as opposed to http://www.originxt.com). To make life easier for them, I
redirected the REQUEST_URI too. Include this in index.php at the top and your life will be settled.
Oh by the way, you should use the $_SERVER[] array for HTTP_HOST. It's safer.
<?php
if(preg_match("/^www\./i", $_SERVER['HTTP_HOST']))
{
header("location: http://originxt.com".$_SERVER['REQUEST_URI']);
}
?>
It's a much more elegant solution. Replace http://originxt.com in the header() with your no-www url.
----
Server IP: 64.71.164.2
Probable Submitter: 67.164.66.46
----
Manual Page -- http://www.php.net/manual/en/ref.url.php
Edit -- https://master.php.net/note/edit/72108
Del: integrated -- https://master.php.net/note/delete/72108/integrated
Del: useless -- https://master.php.net/note/delete/72108/useless
Del: bad code -- https://master.php.net/note/delete/72108/bad+code
Del: spam -- https://master.php.net/note/delete/72108/spam
Del: non-english -- https://master.php.net/note/delete/72108/non-english
Del: in docs -- https://master.php.net/note/delete/72108/in+docs
Del: other reasons-- https://master.php.net/note/delete/72108
Reject -- https://master.php.net/note/reject/72108
Search -- https://master.php.net/manage/user-notes.php