新規のウェブサイトを構築中はアクセス制限をかけて、ユーザーにさらさないほうがよいだろう。
【.htaccess】
AuthUserFile /home/hogehoge/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user
【.htpasswd】
ayabin:ayin/JoUF/2w.
「hogehoge」の部分を自分のユーザー名に変更し、「.htaccess」をDocumentRootに設置。
「.htpasswd」はDocumentRootの上に設置。「.htpasswd」のパーミッションは「604」。
なお、「.htpasswd」のユーザー名とパスワードは以下のサイトで生成してくれる。
http://www.shtml.jp/htaccess/make_htpasswd.html
PHPのcrypt関数を使うと、簡単に生成してくれるらしい(まだ試してない)
コメントする