Block IP Addresses Using .htaccess File

  • Friday 24th April 2015
  • Posted in Tutorials
  • No Comments

Many times you need to block certain IP which is threatening your website/server or is trying to attack your server by creating load on it [ DDOS attack]. You can easily block such IPs using .htaccess file. Once you manage to get the IP address which is playing with your server then you just need to add it in deny list of htaccess file. All IPs which are listed in this list cant access your site anymore and thus you can protect your server from such attacks. All you have to do is to add IP in your htaccess file which is located at root directory by using following code.

<Limit GET>
order deny,allow
deny from IP address

You can add as many IP address as you want in this list. One thing to be noted is that, spammers/hackers can change their IP addresses very easily as most spammers work from their home PCs which are not static and may update very often. Thus may be very difficult for you to get exact IP address which you need to block. So its always better to get a good firewall for your server or a webhost who will manage your dedicated server for such security issues and will monitor it round the clock.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Get in touch with us. we are here to help you


Patil Lane , College Road,
Nashik - 422005.
Phone : +91.9028888645