htaccess to block/redirect referral spam

Discussion in 'Apache' started by esiason14, Dec 6, 2006.

  1. #1
    Even though my stats are protected...Im getting a ton of referral spam.

    I'm having some trouble with my htaccess. I want to check all referrals based on certain keywords. If the referrer has those keywords, I want to throw a HTTP 200 and send them to another page

    check for keywords:
    
    RewriteCond %{HTTP_REFERER} (cialis) [NC,OR]
    RewriteCond %{HTTP_REFERER} (viagra) [NC,OR]
    ................the rest of my keywords to block. I'll save you from having to read them
    Code (markup):
    then redirect if needed
    RewriteRule ^(.*) refer/wedontwantany.php?$1 [L,R]
    Code (markup):
    A couple of things:

    - when I try to use this, the redirect is not working. Any help?
    - I only want to redirect referrers from spammy sites...NOT from search engine listings...Google, MSN, Yahoo, etc. Is there a way to make this happen?
     
    esiason14, Dec 6, 2006 IP