[thelist] Block a Referring URL

jono at charlestonwebsolutions.com jono at charlestonwebsolutions.com
Fri Mar 10 12:26:55 CST 2006


 > googling for 'htaccess block referring url' found this
>
> http://www.ilovejackdaniels.com/apache/block-referrer-spam/
> would that fix your problem...

I cannot get that to work, so here is some more detailed info, and what I
tried:

Info (example):
The referring page on company-one's site is built with frames, and links
to a page one company-two's site that is also built (not by me) with
frames.

The link that refers to company-two's site resides in a navigation frame:
www.company-two.com/side_frame.htm

The link above (that I want to block) links to this page on company-one's
site:
www.company-one.com/folder


What I unsuccessfully tried in the .htaccess file (which I know little
about):

Attempt Number 1:
-------------------

RewriteEngine on

# Block Specified Site

  RewriteCond %{HTTP_REFERER} (company-two\.com) [NC,OR]
    RewriteRule .* - [F]



Attempt Number 2:
-------------------

# try removing ,OR from [NC,OR]

RewriteEngine on

# Block Specified Site

  RewriteCond %{HTTP_REFERER} (company-two\.com) [NC]
    RewriteRule .* - [F]



Attempt Number 3:
-------------------

# try using referring frame's URL where the link resides
# Syntax wrong? - company-two\.com/side_frame.htm

RewriteEngine on

# Block Specified Site

  RewriteCond %{HTTP_REFERER} (company-two\.com/side_frame.htm) [NC,OR]
    RewriteRule .* - [F]


What am I doing wrong in Attempts Nmber 1 - 3?


-- 
Jono Young
Designer | Developer | Illustrator
Charleston Web Solutions
Bringing Higher Standards to the Lowcountry
http://www.charlestonwebsolutions.com



More information about the thelist mailing list