Utilities
|
|
|
|
<? //setup the host domain without www or .com .org .net or whatever it is //
$mainhost = "whatever"; //this makes an array out of the url // $hostvar = explode(".", $_SERVER['HTTP_HOST']); //if statement that works around the use of www or not // if($hostvar[0] == "www")
{ //another type of if statement this one checks to see if the mainhost is the domain used and sends it to the main page otherwise to whatever host.html
$hostvar[1]==$mainhost? header ("Location: http://www.".$mainhost.".com/main.html") : header ("Location: http://www.".$hostvar[1].".com/".$hostvar[1].".html");
} //this is just in case they dont use a trailing www elseif($hostvar[0] != "www")
{ //another type of if statement this one checks to see if the mainhost is the domain used and sends it to the main page otherwise to whatever host.html
$hostvar[0]==$mainhost? header ("Location: http://www.".$mainhost.".com/main.html") : header ("Location: http://www.".$hostvar[0].".com/".$hostvar[0].".html");
} ?>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|