使用.htaccess下载页面/文件夹隐私?

cod*_*rex 0 security .htaccess

我的域名上有一个私人文件夹

http://example.com/protected

我在那里存储了很多图像和pdf文件

 /protected/pad1.pdf
 /protected/pad2.pdf
 /protected/pad1.png
 /protected/pad1.png
Run Code Online (Sandbox Code Playgroud)

这些是文件,如何在.htaccess文件的帮助下隐藏或保护对文件的访问.

只允许那些知道密码的用户.

可能吗 ???

You*_*You 5

查看Apache关于身份验证,授权和访问控制的页面- 一种方法是使用基本或摘要式身份验证.这看起来像这样:

AuthType Digest
AuthName "Private files"
AuthDigestFile /usr/local/apache/passwd/digest
Require user (usernames here)
Run Code Online (Sandbox Code Playgroud)

当然,您需要使用htdigest或生成密码和/或摘要文件htpasswd,但该过程在我链接到的文档中进行了解释.