First, create an apache passwd file somewhere safe (but apache-readable) in the system, using
htpasswd user; then create an .htaccess file in the directory to protect, with the directives
AuthName "restricted documents on _domain_" AuthType Basic AuthUserFile _location of passwd file_ <Files "_file to protect_"> Require valid-user </Files>
you will also need to add
AllowOverride AuthConfig in the relevant
Directory section of your httpd.conf.
© M. Vallisneri 2012 — last modified on 2010/01/29
Tantum in modicis, quantum in maximis