Redirecting Based Upon Referer

I didn’t want to get hits from facebook for a URL that I noticed someone posted on facebook. Added this to the index file, works like a charm:

if( strpos($_SERVER['HTTP_REFERER'], 'facebook.com') > 0 ){
	header('Referer: http://www.facebook.com');
	header('Location: http://www.facebook.com');
}

Leave a Reply

Your email address will not be published. Required fields are marked *