I've got a script that's instantly adding IP addresses to my.htaccess file according to searches in junk e-mail databases. However, I'd like for subsequent visits from individuals addresses to have the ability to notice a 403 ErrorDocument I create. Clearly, though, they can't, as they've been refused. My .htaccess appears like this:

ErrorDocument 403 /403.php

deny from <ip address>
deny from <ip address>
deny from <ip address>
deny from <ip address>
yada yada yada

Any suggestions regarding how to do that? I'm adding the addresses via PHP.

Thanks ahead of time.

I'd think a rewrite rule could be appropriate - though I am not 100% sure you'll be able to redirect according to an ip. You should look into the mod_rewrite paperwork.

You've two-way:

  1. ErrorDocument 403 http://www.yourdomain.com/403.php
  2. ErrorDocument 403 "Go and don't return!"

obviously, First you will redirect user!
For those who have particular file formats in your site(like .php,.txt,.xml,.htm,...) you should use that one but I Don't recommend it!

<Files ~ "\.(inc|sql|.php|.html)$">
  order allow,deny
  allow from all
  deny from 127.0.0.1
</Files>

Update: As Sean Kimball pointed out you should use rewrite mod (obviously it is possible,it is Apache)

RewriteCond %{REMOTE_ADDR}  ^127\.0\.0\.1$
RewriteRule (.*)  403.php