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]

This entry was posted in other stuff and tagged , , . Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>