特定のファイルのみベーシック認証をかけたい場合の.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
Author And Source
この問題について(特定のファイルのみベーシック認証をかけたい場合の.htaccess), 我々は、より多くの情報をここで見つけました https://qiita.com/AkiraAlex/items/fa732d840dc2578679ee著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .