How to deny a referrer?

Discussion in 'Apache' started by Joobz, Dec 8, 2007.

  1. #1
    I have a less than legitimate referrer that I fear has the potential to compromise my adsense account and I would like to block any referrals from this site. How can I facilitate this on a site that is based on cpanel/whm?
     
    Joobz, Dec 8, 2007 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    Referers are hard to deal with because all it takes is for someone to click their address bar & hit enter to bypass anything that can be done efficiently.

    This will send a 403 Forbidden message to anyone comming from bad-domain.com or any subdomain of bad-domain.com when placed in htaccess, vhost container, etc on alot of setups.
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} ^https?://([a-zA-Z0-9-]+\.)*bad-domain\.com
    RewriteRule ^(.+)$ $1 [forbidden,last]
    Code (markup):
     
    joebert, Dec 15, 2007 IP