Welcome IP: 65.55.209.38

How to block a visitor from veiwing your Site

Send this article to a friend Send this article to a friend

The other day, a friend asked me "How do I block a visitor from viewing my Site"? Blocking certain IP addresses from viewing your Website is one way to keep a person or group of people from viewing or accessing your Web Pages. IP blocking will restrict who can view your site. However, you can unintentionally end up blocking a group of people outside of your target group. Therefore IP blocking should generally be avoided if possible. For those that want to proceed, the following tutorial explains how to block an IP address using your .htaccess file.

How to block an IP address using .htaccess:

  1. Download Crimson Editor (text editor)
  2. Using Crimson, open your current .htaccess file if you already have one or create a new file named .htaccess
  3. Add the following code to your .htaccess file:
    XML:
    1. order allow,deny
    2. deny from 100.200.300.4
    3. allow from all

  4. Replace 100.200.300.4 with the IP address you would like to block.
  5. Save the file and upload it via ftp to your server

Side notes: You can easily add more blocked IP addresses. For each address just replicate the "deny from 100.200.300.4" line. Replacing the numbers with the IP you wish to block.

Example:

XML:
  1. order allow,deny
  2. deny from 100.200.300.4
  3. deny from 200.300.400.5
  4. deny from 300.400.500.6
  5. allow from all

If you want to block a complete range of IP addresses, simply drop the last octet from the IP address.

Example:

XML:
  1. order allow,deny
  2. deny from 100.200.300.
  3. allow from all

This would block the range of IP addresses in the 100.200.300.XXX block. X representing any number or numbers.


                            

If you find this information useful, feel free to express your support via a quick PayPal Donation: