Template:Htaccess for bad bots

From LinuxReviews
Jump to navigationJump to search
RewriteEngine on
#
# Bad user-agents
RewriteCond  "%{HTTP_USER_AGENT}" "attentio" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "barkrowler" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "brandwatch" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "cloudfind" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "clickagy" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "domaincrawler" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "dotbot" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "gecko/20060728" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "ltx71" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "megaindex" [OR,NC]
#
# Bots Using Fake User-Agents
RewriteCond  "%{HTTP_USER_AGENT}" "msie3" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "msie 3" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "msie5" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "msie 5.5" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "msie 6.0" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" "mozilla/4.76" [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" megaindex\.com [OR,NC]
#
# Pure Trash Requests (brute force attacks, etc)
RewriteCond %{QUERY_STRING} CONCAT [OR,NC]
RewriteCond %{QUERY_STRING} union\+all\+select [OR,NC]
RewriteCond  "%{HTTP_USER_AGENT}" sqlmap [NC]
#
# Deny
RewriteRule   "^"  "-"  [F,L]