#cd /home/sclin/public_html
#mkdir protect
#vi index.html
#vi /etc/httpd/conf/httpd.conf
# 確定底下這幾行是存在的!
AccessFileName .htaccess
Order allow,deny
Deny from all
# 在某個不受影響的地方加入這一段:
AllowOverride AuthConfig
Order allow,deny
Allow from all
#/etc/rc.d/init.d/httpd restart
#cd /home/sclin/public_html/protect
#vi .htaccess
# 只要加入底下這幾行即可
AuthName "Protect test by .htaccess"
Authtype Basic
AuthUserFile /var/www/apache.passwd
require user test
#htpasswd -c /home/sclin/apache.passwd test
done ok!!
資料來源 : http://linux.vbird.org/linux_server/0360apache.php#www_adv_htaccess
全站熱搜
留言列表