| ⑧Basic認証 |
|
|
| 1. Apache内のconfフォルダ内の httpd.conf を修正する。 |
|
|
<Directory />
Options FollowSymlinks
AllowOverride None
</Directory> |
|
Directoryに保護するディレクトリを指定 また AllowOverride にAllを指定する。 |
|
<Directory "D:/www/public_htm">
Options FollowSymlinks
AllowOverride All
</Directory>
|
|
※複数のディレクトリを保護するには、このエントリを複数指定する。
|
| 2. パスワード保護するディレクトリに.htaccessを作成する |
|
| 2-1. メモ帖で 下記の内容でファイルを作成 |
|
AuthType Basic
AuthUserFile D:/www/.mypsw
AuthName "メンバー専用"
require valid-user
|
|
|
|
|
| 3. 下記の形式で、パスワードファイル .mypsw を作成する。(.htaccessで指定したディレクトリー内) |
| ユーザ名:パスワード |
改行で区切ることにより、複数登録できる
|
| → パスワードの生成 |
|
| 4.認証エラー時のメッセージ対応 |
|
401 |
Basic認証エラー |
|
403 |
パーミッション異常 |
|
404 |
ファイルが見つからない |
|
500 |
CGI実行エラー |
|
専用のエラーページ(html)を用意し、httpd.conf を修正する。 |
|
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html |
|
エラーコードに対応するドキュメントを指定 |
|
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html |
|
エラーページのサンプル |
|
|