Re: blocking referrer URLs

by "Mike Taylor" <lonewolf(at)one.net>

 Date:  Sun, 11 Aug 2002 22:21:02 -0400
 To:  "Karin Christensen" <karinc(at)linkline.com>,
<hwg-techniques(at)hwg.org>
 References:  noteworthycybersolutions max1 computer verizon
  todo: View Thread, Original
If you're on an Apache server you can do this via the .htaccess file.

Here is an example of blocking by referrer in the htaccess file, which will
give the user from that site a 403 (access denied) error:

setenvifnocase Referer "^http://www.sitetobeblocked.org" spam_ref=1
<FilesMatch "(.*)">
Order Allow,Deny
Allow from all
Deny from env=spam_ref
</FilesMatch>

If you're on an NT/XP server you can go to the site properties and block
specific sites.

You can also block sites using a server side scripting language.   One way
is to use a combination of a string function and a redirect function to
achieve what you want.

In ASP (using VBScript) it looks like:

<%
If InStr("insert referrer value here", "www.sitetobeblocked.org") > 0 Then
    Response.redirect("site to redirect them to")
End If
%>

Or PHP would look something like this:

<?
if(strstr($HTTP_REFERER,www.sitetobeblocked.org)) {
    header("Location: http://www.redirectthemhere.com/");
}
?>

Mike

----- Original Message -----
From: "Karin Christensen" <karinc(at)linkline.com>
To: <hwg-techniques(at)hwg.org>
Sent: Sunday, August 11, 2002 8:24 PM
Subject: blocking referrer URLs


> It is possible to prevent someone from accessing a site from a particular
> link?  For instance if a site is linked to from a questionable forum can
one
> block anyone from that referrer URL from accessing the site.
>
> Karin
>
>
>
>
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA