14 November 2009

How to ban an IP address or site name using .htaccess

Ban using IP address. These are sample IP addresses...

42.12.5.34
193.110.145.185 
Code For .htaccess:

<Limit GET POST>
order allow,deny
 deny from 42.12.5.34
 deny from 193.110.145.185
 allow from all
</Limit>
To ban using site name. Do NOT include the "http://www." portion!
These are sample site names:...

domain.com
abc.com

## SITE REFERRER BANNING
RewriteEngine on
# Options +FollowSymlinks


RewriteCond %{HTTP_REFERER} domain\.com [NC,OR]
RewriteCond %{HTTP_REFERER} abc\.com [NC]
RewriteRule .* - [F]


No comments:

Post a Comment