Forum Moderators: phranque
# Deny access using mod_access
Order deny,allow
#
Deny from 61.19.nnn.nnn
Deny from 61.245.nn.nn
#
# Override all Denys if robots.txt, "fatal" ErrorDocuments or bad-bot script are requested
<FilesMatch "^(robots\.txt|403\.shtml|500\.shtml|bad-bot\.php)$">
Allow from all
</FilesMatch>
#
# Set up mod_rewrite and enable rewriting
Options +FollowSymLinks
RewriteEngine on
#
# Skip ALL rewriterules if robots.txt, "fatal" ErrorDocuments or bad-bot script are requested
RewriteRule ^(robots\.txt|403\.shtml|500\.shtml|bad-bot\.php)$ - [L]
#
# Rewrite specific query-string exploit requests to IP-address-banning script
RewriteCond %{QUERY_STRING} mosConfig_[a-z_]{1,21}(=|\%3D) [NC,OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*(script|iframe).*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9a-z]{0,2}) [NC,OR]
RewriteCond %{QUERY_STRING} cPath=http:// [NC,OR]
RewriteCond %{QUERY_STRING} /self/ [NC,OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9a-z]{0,2}) [NC]
RewriteRule ^ /bad-bot.php [L]
#
# Return 403-Forbidden response for all but allowed HTTP methods
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD|POST|OPTIONS|PROPFIND)$
RewriteRule ^ - [F]
#
# Commented-out; Bad syntax or bad examples with no meaningful comments
# RewriteRule php code here [NC,L]
# RewriteRule (location of php file) [NC,L]