Forum Moderators: coopster

Message Too Old, No Replies

Redirect based on url query

Cease and desist for a keyword on my page

         

techrealm

2:53 am on Nov 19, 2003 (gmt 0)

10+ Year Member



I need to parse the referring url for a keyword and if that is true then forward to a different url.

any ideas? a current seo client of mine is a bit confused about why anyone being paid 10% od their sales would link to their site and is viewing it as misuse of their trademark... I just want to make it click away :-)

Birdman

12:50 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?php
if (strpos("keyword",$_SERVER['HTTP_REFERER']))
{
header("Location: new_url_here");
}
?>

That should do it. Make sure it's at the top of the file, before anything is output to the browser or you will get a "headers already sent" error.

Also note that it is not completely reliable.

From php.net


'HTTP_REFERER'

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.