note 37702 added to ref.url
| From: | tappertzhofen at fdos dot de | Date: | Sun, 23 Nov 2003 16:35:14 +0000 |
| Subject: | note 37702 added to ref.url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60879@lists.php.net to get a copy of this message | ||
If you got a server which got only one subdomain and you can't add a subdomain you can easily
create your own "subdomain script". You may create a file "index.php" or what
ever your defaul filename is in the webpage root directory and add the following PHP Code:
<?php
// Get possible subdomain
$full_url = sprintf($HTTP_HOST);
$subdomain = "";
for($i = 0;$i<=strlen($full_url);$i++)
{
$dummy = substr($full_url,$i,1);
if($dummy == ".")
{
break;
}
$subdomain = $subdomain.$dummy;
}
// Get Subdomain List
if ($subdomain <> "www")
{
switch($subdomain)
{
case "download":
$real_url = "http://www.mydomain.com/download/index.php";
break;
case "contact":
$real_url = "http://www.mydomain.com/contact.php";
break;
}
header( "location: $real_url\r\n" );
?>
----
Manual Page -- http://www.php.net/manual/en/ref.url.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37702
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37702&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37702&report=yes
Search -- http://master.php.net/manage/user-notes.php