动态IP的.htaccess块列表? [英] Dynamic IP .htaccess blocklist?

查看:241
本文介绍了动态IP的.htaccess块列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能阻止用户IP与动态的基于文件的黑名单不会忽略​​?

Is it possible to block users from IP adresses with a dynamic file-based blocklist?

那么,假设的.htaccess如下:

So, suppose the .htaccess looks like:

order Deny,Allow
Deny from 123.156.0.1
Deny from 10.0.0.10
Allow from all

能否这份名单进行动态的,例如:

Can this list be made dynamic, for example:

order Deny,Allow
[include Deny list here]
Allow from all

另一种选择当然会用PHP修复它,但它是preferable让Apache的处理这个问题。

Another option would of course be to fix it with PHP, but it is preferable to let Apache handle this.

推荐答案

按照 Apache的文档,它似乎并不可能从一个文本文件中读取值。

According to the Apache docs, it doesn't seem to be possible to read values from a text file.

不过,您可以 包含 < /一>包含​​的IP地址的配置文件。他们将不得不在Apache中的conf文件格式,虽然。

However, you could include a configuration file containing the IP addresses. They would have to be in Apache's conf file format, though.

这应该工作:

order Deny,Allow
include conf/IPList.conf
Allow from all

它甚至可以包含整个目录,即使它不推荐使用。

It's even possible to include whole directories, even though it's not recommended.

这篇关于动态IP的.htaccess块列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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