特定のファイルのみベーシック認証をかけたい場合の.htaccess


特定ファイルのみベーシック認証をかけたい場合。

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
AuthUserFile /home/hoge/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
order deny,allow
<Files test.html>
require valid-user
</Files>

参考にディレクトリ単位のものも。
後半のFilesがいりません。

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
AuthUserFile /home/hoge/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
order deny,allow
require valid-user