【问题标题】:Using htaccess to make directories inaccessible by anyone but localhost使用 htaccess 使除 localhost 之外的任何人都无法访问目录
【发布时间】:2014-09-09 05:39:03
【问题描述】:

我正在尝试使其只有机器/Web 服务器上的本地脚本才能访问 /avatars/ 示例:profile.php?username=Jordan 它必须显示在该脚本上,但如果我直接转到链接它显示错误 403 或任何它需要的。我用过:

Order Deny,Allow
Deny from all
Allow from 127.0.0.1
ErrorDocument 403 "Error: <br /><h2>You are not allowed to access this directly.</h2>

但它不起作用,为什么?

【问题讨论】:

标签: php .htaccess


【解决方案1】:

你需要设置:

AllowOverride None

AllowOverride All

在 httpd.conf 中

测试工作:

【讨论】:

    猜你喜欢
    • 2022-08-06
    • 2010-11-16
    • 1970-01-01
    • 1970-01-01
    • 2016-10-27
    • 2015-05-08
    • 2018-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多