By Samat Jain
March 16, 2006 - 2:14am
I mentioned earlier that to get my old domains, tamasrepus.hotnudiegirls.com and tamasrepus.rhombic.net delisted from search engines, I was going to write a redirection script that would send an HTTP status 301 (permanent redirect) to anything that tries to access those domains. It would send them to this current domain (samat.org).
And I did. So, behold the script (save as index.php):
$headers = array();
$headers[] = "HTTP/1.1 301 Moved Permanently";
$headers[] = "Location: http://samat.org" . $_SERVER['REQUEST_URI'];
foreach($headers as $header) {
header($header);
}
?>
Simple enough. More is needed, though: the web server needs to be told to use this script for all URLs. You can do this easily with Apache and the ErrorDocument directive:
Like this article? Please support my writing! Flattr my blog (see my thoughts on Flattr), tip me via PayPal, or send me an item from my Amazon wish list.
Want to see more of my writing? Subscribe to
Samat Says' RSS feed






