SetEnvIf and Deny from to block bad referrers

My web site is getting referrer spammed and I hate it.  So I put this in my .htaccess:

SetEnvIf Referrer ^http://(www\.)?(closeouts-central|aaacloseoutsnetwork|rstrading|poolsharp|algebra-test)\.com keep_out
Deny from env=keep_out

Which had no result.  I continued to notice spam referrals from these domains.  What's the right way to do this?
LVL 18
Who is Participating?
referer = only one 'r' here. This is a spelling mistake in the rfc

SetEnvIf Referer ^http://(www\.)?(closeouts-central|aaacloseoutsnetwork|rstrading|poolsharp|algebra-test)\.com keep_out
Deny from env=keep_out

But you'll still find those log entries, because now a 403 forbidden is logged. To avoild logging, add env=!keep_out to your logging command in httpd.conf:

CustomLog logs/access_log combined env=!keep_out
(onl log requests if env keep_out is not present)
arantiusAuthor Commented:
This is a little hard to test, but I will try that and get back to you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.