How to block a visitor from veiwing your Site

Block IP Address: 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 (or use your own favorite text editor)
  2. Using the text editor, 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:

    order allow,deny
    deny from 100.200.300.4
    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:

order allow,deny
deny from 100.200.300.4
deny from 200.300.400.5
deny from 300.400.500.6
allow from all

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

Example:

order allow,deny
deny from 100.200.300.
allow from all

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