そもそもApacheの設定で.htaccessファイルを有効化する必要がある。
■手順
#cd /etc/httpd/conf
#vim httpd.conf
設定をAllに書き直す
Options FollowSymLinks  > Options All  
AllowOverride None  > AllowOverride All 
Apacheリスタート
/etc/init.d/httpd start
Starting httpd: 
■.htaccessの書き方
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user(改行)
*/dev/null グループごとでのアクセス制限なし
 
0 件のコメント:
コメントを投稿