#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

arrow
arrow
    全站熱搜

    sclin0323 發表在 痞客邦 留言(0) 人氣()