How to Block a Specific IP Address
Blocking an IP address from your website will prevent a specific computer--the one attached to the IP address--from accessing your website. Whether as a step toward protecting your website or to simply beef up your own privacy, blocking a specific IP address needn't be a difficult task. If you possess very basic Web-building, Web storage or Web hosting know-how, it should be easy.
Instructions
-
-
1
Log in to your website hosting cpanel or its equivalent.
-
2
Open up the file directory and select your Web root directory, usually called "public_html," though some hosts call it something different, such as "webdocs" or "httpdocs".
-
-
3
Double-click on the ".htaccess" file to open it. If your Web root directory does not have an ".htaccess" file, create a new file called ".htaccess." Do not forget to include the "." before "htaccess" file name. Open the file.
-
4
Insert the following tags into your ".htaccess" file:
<Limit GET>
</LIMIT> -
5
Insert the following code between the tags:
order allow,deny
deny from 000.000.000.000
allow from allReplace the "000.000.000.000" with the specific IP address you wish to block.
-
6
Save the file. Visitors from that IP address are now blocked from access to your site.
-
1
Tips & Warnings
To block more than one IP address, simply add another line to your code ("deny from 000.000.000.00").
To block an IP address from a single subdirectory, create an ".htaccess" file only for that subdirectory.