.htaccessでBasic認証

対象のディレクトリに.htaccessファイルを設置

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
AuthUserFile /path/from/root/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
#全てのユーザを許可
#require valid-user 
#htpasswdの中の特定のユーザのみ許可
require user guest
order deny,allow

AuthUserFileの場所に.htpasswdを設置。
以下のコマンドでユーザを追加できる。

$ htpasswd .htpasswd user password