How to Block 301 redirects from third party domains in apache

301-redirectapache-2.2redirect

A client of mine is receiving traffic from domain names which he wants to stop. The trouble I have is that they are using a 301 redirect which our server is just seeing as a normal web hit from the visitor. No referer is picked up in the logs either so blocking them via the relatively normal method of mod_rewrite won't work. Nor will blocking the hosting servers IP as again, the traffic in Apache is showing as coming from a standard visitor.

Is there any other way of blocking this sort of traffic?

Example Apache output for a visit which has been 301'd from another domain:

my_ip_here – – [09/Jun/2011:18:01:49 +0100] "GET / HTTP/1.0" 200 14012 "-" "Wget/1.12 (linux-gnu)"

Best Answer

The answer from http://www.webmasterworld.com/forum92/2261.htm worked for me:

<Limit GET PUT POST>
order allow,deny
allow from all
deny from .offendersite.net
</Limit>

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?offendersite.net/.*$
RewriteCond %{REQUEST_URI} ^/.*$
RewriteRule ^.* - [F]