Monday, May 14, 2012

Blocking based on a specific IP with htaccess

 

 

Do you have a certain IP address or a (handful) that is always causing you problems on your site? Redirect them with this easy few lines of code in your .htaccess file. Replace the xx’s with the IP numbers.


RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$ [OR]
RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$
RewriteRule .* http://en.wikipedia.org/wiki/404_error [R,L]

No comments:

Post a Comment