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 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!

  • Facebook Open Graph META Tags

    It’s no secret that Facebook has become a major traffic driver for all types of websites.  Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly.  And of course there are Facebook “Like” and “Recommend” widgets on every website.  One…

  • Interview with a Pornhub Web Developer
  • Page Visibility API

    One event that’s always been lacking within the document is a signal for when the user is looking at a given tab, or another tab. When does the user switch off our site to look at something else? When do they come back?

  • Build a Toggling Announcement Slider Using MooTools 1.2

    A few of my customer have asked for me to create a subtle but dynamic (…I know…) way for them to advertise different specials on their website. Not something that would display on every page, but periodically or only the homepage. Using a trick…

Source link