Skip to content

Redirect referred users to new site’s respective page

So as you may know, I have moved to a new host and I need to move all things over so I made this awesome script that I hacked together to redirect all users visiting the old site to the new site and the respective page as long as they are being referred from a third party.

It’s pretty short and goes at the top of index.php. Probably won’t be useful to anyone but whatever :)
if(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],"antimatter15") === FALSE){
header( "HTTP/1.1 301 Moved Permanently" );
header("Location: ?".$_SERVER['QUERY_STRING']);

Posted in Meta.

Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.