How to block ip address range using .htaccess in Apache

May 11th, 2005

This article gives instructions for how to, in an Apache .htaccess file, block a range of ip addresses from accessing a web site.

The gist of the article is to add to .htaccess file (usually the first two lines are already there):

Options Includes +ExecCGI
AddType text/x-server-parsed-html .html
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{REMOTE_ADDR} ^72.14.192.
RewriteCond %{REQUEST_URI} !^/gwa-forbidden.html$
RewriteRule ^.*$ /gwa-forbidden.html

Comments are closed.


craniata.net/news is proudly powered by WordPress
Entries (RSS) and Comments (RSS).