If you want to password protect just one file in a directory:
1. cPanel --> Security --> Password Protect Directories
2. Password protect the directory that contains the file you want to protect.
3. Add users/passwords
4. Go to File Manager --> directory you password protected --> .htaccess
5. You should see a group of lines that look like:
Code:
AuthType Basic
AuthName "Super Secret"
AuthUserFile "/home/cPanelUserName/.htpasswds/public_html/directoryName/passwd"
require valid-user
6. Wrap the code in a
FilesMatch directive, ie,
Code:
<FilesMatch "aaaa.txt">
AuthType Basic
AuthName "Super Secret"
AuthUserFile "/home/cPanelUserName/.htpasswds/public_html/directoryName/passwd"
require valid-user
</FilesMatch>
(see Apache documentation to match a group of files)
7. That should leave the rest of the directory "unprotected". You can also go back and use the cPanel to add/delete users/passwords.