0

我需要使用 .htaccess 阻止对目录中特定文件(包含私有数据)的访问。这可能吗?

我们使用 Apache 和 nginx。

4

2 回答 2

1

如果您想阻止查看特定文件,例如图片.jpg:

<files picture.jpg>
     order allow,deny
     deny from all
</files>

用您的文件更改图片.jpg。

如果您想拒绝访问所有带有 .jpg 扩展名的文件:

<files  ~ "\.jpg$">
  Order allow,deny
  Deny from all
</files>
于 2012-11-18T18:28:03.503 回答
0
<Files "yourfile">
  Order allow,deny
  Deny from all
  Satisfy all
</Files>

有关更多信息,请参阅apache 文档...

于 2012-11-18T18:12:11.967 回答