Posted by Piyush On 2:09:00 PM

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

deny from
deny from
deny from 1.2.3.

  • Here in this example I mentation three example for blocking IP. “Deny from” 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 to
  • In the second exp you can deny only one IP and here is the IP is
  • 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.