I need to be able to deny access to an entire site for a single ip address (possibly a couple more later but one for now).

Rather than use Allow, Deny, I'd rather use a redirect in which the URL doesn't change. Largely because I want to redirect the offending pip address to a php page that will add a cookie to the offending machine to track if they change their ip address so I can update the htaccess to deny them access again.

Anyone able to help?

I've tried a number of examples I've found online and so far managed to create nothing but 500 errors and infinte loops! Oh yea, and I managed to block all ip addresses at one point

Edit: Should also point out there's a bunch of other stuff already in my htaccess file that needs to remain working.

# Is it a bad IP address.RewriteCond %{REMOTE_ADDR} ^1\.2\.3\.4$ [OR]# Or another bad IP address.RewriteCond %{REMOTE_ADDR} ^5\.6\.7\.8$ [OR]# Or do they have the cookie set?RewriteCond %{HTTP_COOKIE} ^(.*;\ )?cookiename=cookievalue(;\ .*)?$# Rewrite to one file to do whatever you want.RewriteRule ^bad_ips\.php$ /bad_ips\.php [QSA,L]