How to Block a Range of IP Addresses

As much as content creators want traffic to their website, there is such thing as the wrong type of traffic. Sometimes it’s content scrapers, sometimes it’s malicious bots; either way, it’s important to know how to block problematic IPs from your site. To block a range of IP addresses using an .htaccess file, you can […]

The post How to Block a Range of IP Addresses appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh

As much as content creators want traffic to their website, there is such thing as the wrong type of traffic. Sometimes it’s content scrapers, sometimes it’s malicious bots; either way, it’s important to know how to block problematic IPs from your site.

To block a range of IP addresses using an .htaccess file, you can use the * wildcard for pieces of the IP address:

Order Allow,Deny
Deny from 219.198.*.*
Allow from all

You can also use a regular expression:

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^219\.198\.\.
RewriteRule ^ - [F]

Don’t let known attackers and problematic bots bring your website to a halt! Be quick to check your site logs and ban addresses that are causing havoc!

The post How to Block a Range of IP Addresses appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh


Print Share Comment Cite Upload Translate Updates
APA

David Walsh | Sciencx (2023-03-27T10:51:44+00:00) How to Block a Range of IP Addresses. Retrieved from https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/

MLA
" » How to Block a Range of IP Addresses." David Walsh | Sciencx - Monday March 27, 2023, https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/
HARVARD
David Walsh | Sciencx Monday March 27, 2023 » How to Block a Range of IP Addresses., viewed ,<https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/>
VANCOUVER
David Walsh | Sciencx - » How to Block a Range of IP Addresses. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/
CHICAGO
" » How to Block a Range of IP Addresses." David Walsh | Sciencx - Accessed . https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/
IEEE
" » How to Block a Range of IP Addresses." David Walsh | Sciencx [Online]. Available: https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/. [Accessed: ]
rf:citation
» How to Block a Range of IP Addresses | David Walsh | Sciencx | https://www.scien.cx/2023/03/27/how-to-block-a-range-of-ip-addresses/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.