Banning bad referrer bots, my code needs help

Fix it!!

Banning bad referrer bots, my code needs help

Postby john37 » Sat Dec 29, 2007 4:02 am

Hi

I ma trying to ban this stupid bots which i see in my logs , i found a code somewhere but it don't work and they still appear in my referrer logs



Code: Select all

RewriteCond %{HTTP_REFERER} billigmedicin\.com [NC,OR]
RewriteCond %{HTTP_REFERER} SPAM-gl-pills\.com
RewriteCond %{HTTP_REFERER} tvsetmp3\.com
RewriteCond %{HTTP_REFERER} mp3vio\.com
RewriteCond %{HTTP_REFERER} buypalmtrees\.com
RewriteCond %{HTTP_REFERER} stockleaf\.com
RewriteCond %{HTTP_REFERER} play89\.com
RewriteRule .* - [F]


I ll be happy if someone correct the code.
Thanks
john37
 
Posts: 12
Joined: Tue Jan 23, 2007 4:10 pm

Postby richardk » Sat Dec 29, 2007 1:44 pm

You have to have [NC,OR] after every RewriteCond except the last one which just needs [NC]. You can also put many one one line with the regular expression alternation syntax
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_REFERER} (billigmedicin|SPAM-gl-pills)\.com [NC,OR]
RewriteCond %{HTTP_REFERER} (mp3vio|buypalmtrees)\.com [NC,OR]
RewriteCond %{HTTP_REFERER} (stockleaf|play89|tvsetmp3)\.com [NC]
RewriteRule .* - [F,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby john37 » Sat Dec 29, 2007 3:46 pm

One again Thank you Richard :)

I wasn't seen that we can put many sites in to one line cool

Since i have "RewriteEngine On" on my htaccess i won't type it again


Happy new year to you and to your family
john37
 
Posts: 12
Joined: Tue Jan 23, 2007 4:10 pm


Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron