I have created an .htaccess files that will prevent anyone from accessing a file unless he has a username and a password, how can I log files when anyone tries to access with incorrect information and then ban the Ip address.
I know it in php but .htaccess i am still new to it.
Thank you everyone.
You could use
ErrorDocument 401 /log_request.phpto send all those requests to some PHP script.Take a look at this tutorial for more info: http://www.askapache.com/htaccess/htaccess-htpasswd-basic-auth.html
Edit: if you simply want to ban and nothing else than I would recommend using http://www.fail2ban.org/