Quantcast
Channel: apache – softelメモ
Viewing all articles
Browse latest Browse all 68

.htaccess で ベーシック認証のかかったディレクトリの中に認証不要のディレクトリを作る

$
0
0

問題

http://example.com/a/ ここにはベーシック認証を設定して

でも

http://example.com/a/b/ ここにはベーシック認証なしでアクセスできるように

設定できる?

答え

.htaccess でやってみた。

/a のディレクトリには以下の .htaccess を置く。

AuthType Basic
AuthName "Input ID and Password."
AuthUserFile /hoge/fuga/.htpasswd
Require valid-user

/a/b のディレクトリには以下の .htaccess を置く。

Order Deny,Allow
Allow from all
Satisfy Any

すると、

/a/~~ にはベーシック認証がかかって
/a/b/~~ にはベーシック認証がかかっていない状態が作れる。


Viewing all articles
Browse latest Browse all 68

Trending Articles