Last active
October 6, 2021 03:02
-
-
Save iAugur/4435392 to your computer and use it in GitHub Desktop.
Sample .htaccess for blocking common Spammer IPs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This example shows how to deny access to individual and ranges of IP address | |
## Typically indentified as spammers | |
## Taken from http://perishablepress.com/stupid-htaccess-tricks/ | |
##Deny from multiple single IPs | |
SetEnvIfNoCase REMOTE_ADDR ".*(5.167.182.32|125.79.65.108|178.137.83.159|184.154.149.194|192.210.62.162).*" BlockedAddress | |
SetEnvIfNoCase REMOTE_ADDR ".*(94.23.20.123|92.243.84.187|58.61.239.201).*" BlockedAddress | |
#deny from a range e.g. 91.236.74.0/24 | |
SetEnvIfNoCase REMOTE_ADDR "91.236.74\..*" BlockedAddress | |
##deny from single ips in a range | |
#deny from 198.15.126.0/24 | |
#deny from 198.15.124.0/24 | |
#deny from 198.15.122.0/24 | |
SetEnvIfNoCase REMOTE_ADDR "198.15.12(2|4|6)\..*" BlockedAddress | |
#shadowkd 199.19.104.198 | |
SetEnvIfNoCase REMOTE_ADDR "199.19.104.198" BlockedAddress | |
# deny any matches from above and send a 403 denied | |
<Limit GET POST PUT> | |
order deny,allow | |
deny from env=BlockedAddress | |
allow from all | |
</Limit> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment