[英]how to write .htaccess and protect sites files and folder in laravel
[英].htaccess doesnt protect files in folder
我有一個簡單的.htaccess文件和一個.passwd文件,用於對apache2下的文件夾進行密碼保護:/ var / www / test
如果我想連接到example.com/test,效果很好。 但是在測試文件夾中也有一個download.exe。 如果我連接到example.com/test/download.exe,則可以下載文件而無需輸入用戶名和密碼。
我該如何更改? .htaccess文件:
AuthType Basic
AuthName "protected area"
AuthUserFile /var/www/test/.passwd
Require valid-user
在訪問example.com/test之前,請嘗試使用其他瀏覽器或其他計算機訪問example.com/test/download.exe。 您使用的瀏覽器可能已經緩存了下載的文件或使用的憑據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.