Knowledgebase: Web Hosting > Tutorials
How can I block an IP from my website?
Posted by Brian F., Last modified by Brian F. on 29 September 2010 10:53 AM
A lot of times, you'll find you need to block an IP or an entire range of IPs from accessing your website for various reasons. There are a few ways to do this:

  1. Login to cPanel, and type 'IP Deny' into the top left finder. (Picture)

  2. If you want to block a single IP, type in the IP and click 'add'. (Picture)

  3. Once added, you should see the entry at the bottom of the IP Deny Manager page. (Picture)

  4. If you want to block a range of IPs, type in the first, second, or third octets and click 'add'. (Picture)

  5. Once added, you should see the entry at the bottom of the IP Deny Manager page. (Picture)

Alternatively, you can modify your .htaccess file, which can be found in the root directory of your websites FTP. Below is a quick how-to on doing this, but some further reading is available on Google for those who are interested.

  1. To block a single IP:

    order allow,deny
    deny from 192.168.1.1
    allow from all

You'll want to replace 192.168.1.1 with the IP you want to deny.

  1. To block multiple IPs:

    order allow,deny
    deny from 192.168.1.1
    deny from 201.202.203.204
    deny from 8.18.250.251
    allow from all

Again make sure you're replacing these IPs with the ones you actually want to ban.

  1. To block an entire range of IPs:

    order allow,deny
    deny from 192.168.
    allow from all

This will block any incoming requests from IPs starting with 192.168.
(94 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).