I have detected that a range of IP addresses may be used in a malicious way and I don\'t know how to block it.
I would like to block the range 66.249.74.* from acces
Use just the first 3 octets
Order Allow,Deny
Deny from 66.249.74.
Allow from all
eg:
<Files *>
order deny,allow
deny from 2.72.0.0/13 2.92.0.0/14 2.132.0.0/14
</Files>
Great howto with ip ranges here:
http://www.wizcrafts.net/russian-blocklist.html
Also these are up to date lists of offending ip ranges.
I’ve just used
Order Allow,Deny
Deny from 188.143.*.*
Allow from all
as spam attack comes from xxx.xxx.0-80.0-80
.
You can go to: and enter ips and it will generate the file for you. http://www.htaccesstools.com/block-ips/
Also for example you want to block the ip address range
you want would be:
Order Allow,Deny
Deny from 66.249.74.0/24
Allow from all
Or You Can Do:
You can indicate which addresses you wish to block using RewriteCond %{HTTP_REFERER}
.
This is a Working Example:
# BLOCK VISITORS REFERRED FROM GOOGLE.COM
RewriteCond %{HTTP_REFERER} ^https?://([a-z0-9-]+\.)?google\.com [NC]
RewriteRule .* - [F]
The example above uses a regular expression, so it will block:
https://
or http://
google.com
The [F]
flag means Forbidden
. The server will return a 403 Forbidden Error
.
you can do it easily by adding IP Ranges to your .htaccess file by downloading the full ranges from https://www.ip2location.com/blockvisitorsbycountry.aspx and uploading the .hataccess back to the directory you want blocked.
I recently blocked Russia by this method cause of getting loads of spam registrations on my forum and the forum never needs any contribution from this country.
You could use:
Order Allow,Deny
Deny from 66.249.74.0/24
Allow from all
Or you could use this:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^66\.249\.74\.
RewriteRule ^ - [F]