BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

Block IP Address From Website On Apache

There are 3 ways to block (ban) IP address from accessing website in Apache: Modify httpd.conf, redirect IP to another predefined page, and using .htaccess.

The below statement assumes we will block or ban IP from port 80.

1. Setting httpd.conf to block

Add these settings in httpd.conf:

     <Location />
     Order Allow,Deny
     Deny from all

2. Redirect IP to another page

Also set this in httpd.conf, Configuration as:

DocumentRoot "/srv/www/default"

3. Setting .htaccess

If you want to block IP from some bad users, add this in your .htaccess.

Order Deny,Allow
Deny from

To block a IP range, for example 12.34.56.x, like this:

Order Deny,Allow
Deny from 12.34.56.
Allow from all

Related Articles


Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.


  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530