Subdomain redirection
Posted: Sun Sep 26, 2004 3:17 pm
I am using a web server package called 'Lansuite' and it does not support subdomains. By using a dynamic host I have no problems setting up, for example, forum.hostedby.homeip.net, where 'forum' is the sub domain. I have worked out how to grab the url via HTTP_HOST.
But of course, this then changes the URL in the address bar, is the original address can be retained? or am I out of look.
Any help would be appreciated.
Code: Select all
<?php
$page = $_SERVER['HTTP_HOST'];
$noms[0]="/forum.hostedby.homeip.net/";
$allervers[0]="hostedby.homeip.net/subsite-forum";
$noms[1]="/yahoo.hostedby.homeip.net/";
$allervers[1]="yahoo.com";
$noms[2]="/bad.and.ugly.hostedby.homeip.net/";
$allervers[2]="microsoft.com";
$dir=preg_replace($noms, $allervers, $page);
if (!($page === $dir))
{
header("Location: http://$dir");
exit;
}
print "The domain name <b>$page</b> isn't valid...please verify syntax and / or address";
?>Any help would be appreciated.