简体   繁体   English

.htaccess不能保护文件夹中的文件

[英].htaccess doesnt protect files in folder

I have an simple .htaccess and a .passwd file for a password protection of an folder under apache2: /var/www/test 我有一个简单的.htaccess文件和一个.passwd文件,用于对apache2下的文件夹进行密码保护:/ var / www / test

Works fine if i want to connect to example.com/test. 如果我想连接到example.com/test,效果很好。 But in the test folder is also a download.exe. 但是在测试文件夹中也有一个download.exe。 If i connect to example.com/test/download.exe i can download the file without being asked for a username and a password. 如果我连接到example.com/test/download.exe,则可以下载文件而无需输入用户名和密码。

How can i change that? 我该如何更改? The .htaccess file: .htaccess文件:

AuthType Basic
AuthName "protected area"
AuthUserFile /var/www/test/.passwd
Require valid-user

Try a different browser or a different computer to access example.com/test/download.exe before accessing example.com/test. 在访问example.com/test之前,请尝试使用其他浏览器或其他计算机访问example.com/test/download.exe。 Browsers you are using can have cached the downloaded file or the credentials used. 您使用的浏览器可能已经缓存了下载的文件或使用的凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM