Hi,
these are the steps to protect a single file in a directoy by a password.
For example: The folder /var/www/html is and the file you want protect is called internal.html
Define a username (here “agent”) and create a password file (.htuser)
root@debdevt # htpasswd -c -B /var/www/html/.htuser agent
create a .htaccess file in the folder /var/www/html with content:
<FilesMatch "internal.html">
AuthName "Only for Agents"
AuthType Basic
AuthUserFile /var/www/html/.htuser
require user agent
</FilesMatch>
Note:The AuthUserFile must contain the absolute path to the .htuser file.
That’s it 🙂
Michael