アプリ版:「スタンプのみでお礼する」機能のリリースについて

htaccess htpasswdを設置して、拡張子指定のパスワード認証をするページにしています。

フォルダ/.htaccess .htpasswd/規制ページhtml/pdf等/

<FilesMatch "\.((pdf|PDF)|(TIFF|tiff)|txt)$">
DirectoryIndex index.html index.cgi index.php
AuthUserFile /.htpasswdの場所
AuthType Basic
AuthName "Web access"
Require valid-user
Satisfy all
Order allow,deny
Allow from all
</FilesMatch>
現在、上記内容(htaccess)で、規制ページ内にリンクしている下位フォルダ内のPDFとtiffとtxtのファイルを規制しています。

行いたいのは、pdfはこのパスワード、tiffはこのパスワードといった具合に個別拡張子ごと規制設定をしたいと考えています。

どのように記述 設置すれば可能でしょうか。

A 回答 (2件)

以下のようにディレクティブを分ければ良いのでは?


もちろんディレクティブごとのAuthUserFileは分けて作ります。

<FilesMatch "\.(pdf|PDF)$">

</FilesMatch>

<FilesMatch "\.(TIFF|tiff)$">

</FilesMatch>

<FilesMatch "\.txt$">

</FilesMatch>
    • good
    • 1
この回答へのお礼

回答有難うございました。
早速、分けて記述してパスワードファイルも分けて指定し直してみたら希望通りの動作になりました。

お礼日時:2015/10/23 15:50

ディレクティブをpdfとtiff、txtでそれぞれ分ければいい話では。



<FilesMatch "\.(pdf|PDF)$">
DirectoryIndex index.html index.cgi index.php
AuthUserFile /PDF用の.htpasswdの場所
AuthType Basic
AuthName "Web access"
Require valid-user
Satisfy all
Order allow,deny
Allow from all
</FilesMatch>
<FilesMatch "\.(TIFF|tiff)$">
DirectoryIndex index.html index.cgi index.php
AuthUserFile /TIFF用の.htpasswdの場所
AuthType Basic
AuthName "Web access"
Require valid-user
Satisfy all
Order allow,deny
Allow from all
</FilesMatch>
<FilesMatch "\.txt$">
DirectoryIndex index.html index.cgi index.php
AuthUserFile /txt用の.htpasswdの場所
AuthType Basic
AuthName "Web access"
Require valid-user
Satisfy all
Order allow,deny
Allow from all
</FilesMatch>
    • good
    • 0
この回答へのお礼

回答有難うございます。
同ファイルに複数記述できるのですね。
設定しましたら各々規制できました。

お礼日時:2015/10/23 15:50

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!