Because of an earlier scripting error, a popular search robot has indexed most of my pages with the hostserver URL not the branded domain. Ever since then I have seen a steady stream of requests for pages with this hostserver domain. I want to redirect all of these hits so bookmarks and return visits will be more likely.
I wrote this script which seems to work:
<?
/This redirects urls form hostserver to homeschoolbuzz domain equivalent/
$request = ($SERVER['HTTP_HOST']);
if ($request == "host28.ipowerweb.com") {
$request .= ($SERVER['REQUEST_URI']);//these two get the actual requested path
$redirect = str_replace("host28.ipowerweb.com/~homescho", "homeschoolbuzz.com", "$request");
//this replaces it with homeschoolbuzz only if it is wrong.
header("Location: [url]http://[/url]$redirect");
exit;
} else {
return;
}
?>
The problem is, (and this may seem small) when I run this script on my localhost (development server) it really slows down the loading of pages. (there is a 20-30 second delay) Since I want to have identical pages on my local and remote server, I would like to know why this happens.
Of course, the URL for the local version is localhost/~homescho/test.php and maybe since this contains neither the expected bad-hostname or the redirect, it is slow but this doesn't really make any sense. shouldn't the "if" statement just skip this URL if it doesn't match the request?
I hope this makes some sense.