apache - .htaccess:如何通过 IP 限制对单个文件的访问?

标签 apache .htaccess apache2 apache2.2

我已经查看了所有内容,但不断遇到有关目录级别 IP 限制的相同信息,通常看起来像这样:

Order Deny,Allow
Deny from all
Allow from 123.123.123.123

是否可以将相同类型的访问限制绑定(bind)到页面/文档?

最佳答案

有关更新的 Apache 2.4 示例:

<Files file.html>
    Require ip 123.123.123.123
</Files>

以下是有关其他选项和示例的更深入的文档:https://httpd.apache.org/docs/2.4/howto/access.html以及 <Files> 的文档指令:https://httpd.apache.org/docs/2.4/mod/core.html#files

Note that <Files> can be nested inside <Directory> sections to restrict the portion of the filesystem they apply to.

关于apache - .htaccess:如何通过 IP 限制对单个文件的访问?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3604526/

相关文章:

mongodb - 错误 : while start Apache nutch with mongodb

php - PHP 代码中的错误

php - 为什么 header() 函数非常慢?

java - 本地主机上的服务器 Apache TomEE 无法启动

.htaccess - 共享 ssl 404 w/existing htaccess - follow-up to/questions/12737308/

.htaccess - 多语言网站的Htaccess和网址

php - Kohana 3 从另一台服务器下载文件

apache - 使用 htaccess 阻止 URL

.htaccess - AllowOverride None,并且 .htaccess 有效

Apache2 未在 header 中发送 "Content-Type"