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.
Your IP Has Been Temporarily Blocked
Keep in mind that it is possible to end up unintentionally blocking a group of people outside of your target group. Therefore IP blocking should generally be avoided, if at all possible. For those who still want to proceed, the following tutorial explains how to block an IP address using your .htaccess file.
How To block IP Address using .htaccess
- Download Crimson Editor (Notepad++ or use your own favorite text editor).
- Using the text editor, open your current .htaccess file if you already have one or create a new file named .htaccess.
- Add the following code to your .htaccess file:
order allow,deny deny from 100.200.300.4 allow from all
- Replace 100.200.300.4 with the IP address you would like to block.
- Save the file and upload it via ftp to your server
Blocking Multiple IP Addresses
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.
order allow,deny deny from 100.200.300.4 deny from 200.300.400.5 deny from 300.400.500.6 allow from all
Blocking a range of IP Addresses
If you want to block a complete range of IP addresses, simply drop the last octet from the IP address. Here's an 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.