5 April 2016

Block IP Address For Website

Blocking a website for a country or city is not an easy task for this first you know the IP address which you want to block. Then after you create a .htaccess text file, no - no this is not any extension for a file it is a name of file it means your text file name is -> .htaccess.txt. Yes you should make this file in notepad, which is available in every system. Then after you write code in your file what I giving below …..

<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 1.2.3.4/26
deny from 1.2.3.4
deny from 1.2.3.

  • Here in this example I mentation three example for blocking IP. “Deny from 1.2.3.4/26” means you can deny a range of IP means if you want to deny an IP range you use it here in this exp the IP range is 1.2.3.4 to 1.2.3.26.
  • In the second exp you can deny only one IP and here is the IP is 1.2.3.4.
  • In third exp you can deny a subnet mask of and here are that subnet mask is   deny from 1.2.3.
  • After save this file you have to upload this file on your server in that directory that contains your site.


Now your site is blocked for those IP that you mentation in file.

0 comments:

Post a Comment