Basic認証をかけてみる
AuthUserFile /home/hoge/.htpasswd //パスワードファイルのパス AuthGroupFile /dev/null //グループごとのアクセス制限なし AuthName "Please enter your ID and password" //表示されるメッセージ AuthType Basic //Basic認証 require valid-user //全ユーザーに認証
.htpasswdには以下の方式でアカウントとパスワードを指定します。
hoge:abcdefghijglmn [username]:[password]
また、特定のファイルだけBasic認証を外したい時は、
AuthUserFile /home/hoge/.htpasswd AuthGroupFile /dev/null AuthName "Please enter your ID and password" AuthType Basic require valid-user <Files "hoge.html"> Satisfy any order allow,deny allow from all </Files>
Satisfy anyでIPアドレスの制限を行っており、
order allow,denyでデフォルトを全てのアクセス拒否にし、
allow from allで全てのアクセスを許可にしています。