How to block an IP Address

A user is accessing our website and we'd like to block this user as they continue to submit fraud orders, or steal graphics etc. While we're at it, how do we block an entire IP Range to prevent other users in the same IP Block?

To block an IP number you will need to edit the .htaccess file on your site. If you do not have an .htaccess file created, you can create one by making a text file and uploding it to your /public_html folder in your site.

In the file you will place the following information

order allow,deny
deny from 125.239.5.232
allow from all.

In this example we are blocking the IP number 125.239.5.232

If you want to block a RANGE of IP numbers, you can use the following:

order allow,deny
deny from 125.239.5.232-240
allow from all.

This will DENY access to anyone with the IP numbers 125.239.5.232 through 125.239.5.240. You can also do a "deny from 125.239.5" and don't put the 4th set of numbers. This will block 125.239.5.1-255 Likewise you can do 125.239 or just 125.

Please be careful on the blocking of IP numbers as you can block out whole countries by setting up a range of IP numbers. Many times it's best to post individual IP numbers, but if you require a range, the above example would be how to accomplish it.

  • 30 Users Found This Useful
Was this answer helpful?

Related Articles

301 Redirect for All Domains

So you've purchased a ton of domains to park on your main account, but you don't want Google...

301 Redirect from non-www to www -- Without Looping!

So - you want to improve your search engine rankings, and SEO gurus told you that Google...

Block a country using mod_geoip

Do you have a list of countries that you want to block access to your site?  Have you...

Force folder to redirect to https mode

Sometimes webmasters need to force particular folders to load in HTTPS mode.  This is...

How do I redirect a page or folder?

have removed a file from being on the website and would like to forward people who were...