Sometimes you want to ban someone from your website.  To ban someone from accessing your website you need to know their IP address.   You can get their address from your server logs or emails.

If you ban someone, though, they’ll know it, because they will receive a server code informing them access is denied to your site.

Much better than an outright ban is fooling them into believing they are seeing a real page on your website, when in fact they are the only one seeing that page.   Everyone else in the world gets to see your website, but they get to see a fake page, or anything you want, and they’ll never know!

Here is the code you need for your .htaccess file to redirect two IP addresses to a new page whenever they try to access any page on your website:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} 10\.20\.30\.40 [or]
RewriteCond %{REMOTE_HOST} 11\.22\.33\.44
RewriteRule .* http://yourdomain.com/fakepage.html [R=301,L]

Just replace the two sample IP addresses (10.20.30.40 and 11.22.33.44) with the IP addresses you want to ban.  I included two addresses so you can see how the code works when there is more than one address, using the [or] command.  This can be used over and over for more IP addresses.

Some amateur php programmers, like Robert Plank, do this all wrong, and make it obvious someone is banned from a website.  Making it obvious is not only bush, but a complete waste of time and ineffectual since it will take someone about 30 seconds to sign on through a proxy service to avoid an IP ban.

That is why you need a fake page.   One trick is to send the person to page that mimics what is displayed when there is a server error code.  Then, the idiot you want to ban thinks you’re out of service, when in fact they’re the one out in the cold.

Copy the code below to your web site.
x 
Leave a Reply