Ok, let say everyone who visit tutu.mydomain.com goes to the index page. How would I be able to extract the name tutu from mydomain?
So everytime that subdomain is entered, it only displays tutu on the index page and not the whole domain tutu.mydomain.com with the script I am using now.
The following just displays the whole subdomain...
$domain = getenv("HTTP_HOST");
$domain = strtolower("$domain");
$domain = trim("$domain");
$domaincheck = explode(".", $domain);
while ($domaincheck[0] == "www") {
$domain = substr("$domain", 4);
$domaincheck = explode(".", $domain);
}
while (eregi("--", $domain)) {
$domain = str_replace("--", "-", $domain);
}
echo $domain
Please help, thanks.