Click to See Complete Forum and Search --> : QUERY: Stop a website from linking to a clients site


CSPO
07-09-2009, 01:51 AM
Hi,
A certain web site has linked to a clients site. The client does not want this link between the two sites to occur, as the link may mislead the user.

Is there a bit of code that will redirect any pages that come from the offending URL to my clients URL?

I have searched the web, but nothing comes up, except for stopping others from linking to your images.

Regards
ALf...

the-ferret
07-09-2009, 06:14 AM
Not sure of the syntax but you can def do this in .htaccess file

RewriteEngine On
RewriteCond %{http_referer} ^http://(www\.)?sitetoblock.com.*$
RewriteRule .* - [F,L]

or you could do a specific check in PHP by looking at the value of $_SERVER['HTTP_REFERER'] and redirecting/changing content dynamically as needed.

I am sure that others will correct my syntax if wrong :D