すぐわすれちゃうんでコピペできるようにメモっておきます。まずはファイルの拡張子でアクセス制限。
<Files ~ "\.log$"> deny from all </Files>
複数の場合はこんな感じ。
<Files ~ "\.(log|pl)$"> deny from all </Files>
ファイル名で制限するならこんな感じ。
<Files ~ "^edit.cgi$"> deny from all </Files>
BASIC認証してみる。
AuthUserFile /home/hogehoge/.htpasswd AuthGroupFile /dev/null AuthName "Please enter your ID and password" AuthType Basic require valid-user
.htpasswdを作るにはコマンドラインから
とする。2人目からは-cはつけずに
$ htpasswd -c /home/hogehoge/.htpasswd ユーザ名
とすればOK。
$ htpasswd /home/hogehoge/.htpasswd ユーザ名
特定のユーザのみ許可したい場合には以下のような感じで。
AuthUserFile /home/hogehoge/.htpasswd AuthGroupFile /dev/null AuthName "Please enter your ID and password" AuthType Basic require user ユーザ名