Archive

Archive for the ‘Uncategorized’ Category

Use htaccess to protect your web folder

August 16th, 2009

Use htpasswd to create password file, or add password
htpasswd -c .htpasswd fred
htpasswd .htpasswd linda

Then create a .htaccess file with the following text (not the path to the password file has to be full path)

AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "My Secret Page"
Require valid-user

To protect individual files, use
AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "My Secret Page"

<Files "mypage.html">
Require valid-user
</Files>

<Files "myotherpage.html">
Require valid-user
</Files>

Author: Xu Cui Categories: Uncategorized Tags: