Don’t Wanna Pu*sy in My Stats
All right, two posts today, so what? Just checked my referrer stats and found all kind of pu*sies all over the list. There is black pu*sy, red pu*sy, smelly pu*sy… If you’re sick of all this referrer spam, that can be fixed with a simple .htaccess directive:
<IfModule mod_security.c> SecFilterEngine On SecFilterScanPOST On SecFilterDefaultAction "deny,status:412" SecFilterSelective "HTTP_REFERER" "(undesired keyword|undesired keyword|undesired keyword)" SecFilterSelective "POST_PAYLOAD" "(undesired keyword|undesired keyword|undesired keyword)" </IfModule>
Listed keywords should be separated with a pipe (|) character.
Check with your host (run phpinfo() on your server) if it supports mod_security, even though most of them do. This should help you get rid of referrer spam as well as comment spam (for the specified keywords at least). If you want to know more (and I know you want), feel free to ride off to Introducing mod_security article.

2 Comments
Great article. It was pointed out to me by a visitor to my site and a link to it has been added to our Resources page. Thanks!
Comment (#) by Kevin — 17th July 2005.
So this looks great but what is the difference between http and post?:
SecFilterSelective “HTTP_REFERER” “(?????)”
SecFilterSelective “POST_PAYLOAD” “(?????)”
Comment (#) by Morpurgo.nl — 7th August 2005.
Sorry, the comment form is closed at this time, but if you have anything to say, please send me a message.