
ApacheでBasic認証作成
① 管理者権限のコマンドプロンプトでPasswordを作成
x:> x:\xampp\apache\bin\htpasswd -c x:\xampp\apache.htpasswd user名」を入力してEnterキーを押す。
1.New password: →入力
2.Re-type new password: →入力
3.次のように表示されればOK。→Adding password for user名
1.New password: →入力
2.Re-type new password: →入力
3.次のように表示されればOK。→Adding password for user名
② .htpasswd(ユーザ名:xxxxxxxxxxxx)を「htpasswd.txt」に変更
x:\xampp\apacheに.htpasswd(ユーザ名:xxxxxxxxxxxxxxx)ができてるので「htpasswd.txt」に変更して、FTPでBasic認証を施したいディレクトリーのフォルダー内にアップロードする。
(他:mcオプション(MD5)、Passwordの暗号はどちらも可)
③ サーバ上の絶対パスの確認とhtaccess.txtの作成
<?php echo dirname(__FILE__);
④ htaccessのフォームの作成
AuthUserFile サーバー上の絶対パス/フォルダ名/.htpasswd AuthName "Enter your ID and password." AuthType Basic require valid-user
次に
以上で