Apacheの.htaccessで特定のファイルの基本認証を回避する方法
Apacheの.htaccessで特定のファイルの基本認証を回避する方法は次のとおりです。
(例)pで始まるpdfファイルを許可する場合
2.2系
(例)pで始まるpdfファイルを許可する場合
2.2系
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
require valid-user
<FilesMatch "^p.*\.pdf$">
Satisfy Any
Order allow,deny
Allow from all
</FilesMatch>
2.4系
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
<FilesMatch "^p.*\.pdf$">
Require all granted
</FilesMatch>


![サーバ構築の実際がわかる Apache[実践]運用/管理](https://m.media-amazon.com/images/I/813s6gTOr9L._SY425_.jpg)
コメント
コメントを投稿