我試圖用.htaccess保護子文件夾的index.php頁面。如何使用.htaccess保護index.php
當我導航到example.com/subfolder/index.php
時,保護工作正常。但是,當我剛剛去example.com/subfolder
我得到一個401錯誤。
下面是相關.htacess代碼:
AuthUserFile /home/myfolder/subfolder/.htpasswd
AuthName "Please enter your password"
AuthType Basic
<files index.php>
require valid-user
</files>
什麼我需要做不同?
你是什麼'protect'是什麼意思?使用用戶名和密碼來驗證訪問者,你的意思是? – Raptor