如何记录不正确的输入(PHP的.htaccess) [英] how to log incorrect entries (php .htaccess)

查看:170
本文介绍了如何记录不正确的输入(PHP的.htaccess)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个.htaccess文件,将prevent任何人访问一个文件,除非他有一个用户名和密码,我怎么能日志文件时有人试图访问与不正确的信息,然后禁止IP地址。

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.

我知道它在PHP的.htaccess,但我仍然新的吧。

I know it in php but .htaccess i am still new to it.

感谢大家。

推荐答案

您可以使用的ErrorDocument 401 /log_request.php 所有这些请求发送到一些PHP脚本。

You could use ErrorDocument 401 /log_request.php to send all those requests to some PHP script.

看看这个教程的详细信息:的http:// www.askapache.com/htaccess/htaccess-htpasswd-basic-auth.html

Take a look at this tutorial for more info: http://www.askapache.com/htaccess/htaccess-htpasswd-basic-auth.html

编辑:如果你只是想禁止,没有别的比我会建议使用 http://www.fail2ban.org /

if you simply want to ban and nothing else than I would recommend using http://www.fail2ban.org/

这篇关于如何记录不正确的输入(PHP的.htaccess)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆