|
Password
Protecting Web Folders
If you need to password
protect a web folder, Say http://icannbudgetDOTorg/secure then follow the
below instructions.
1) Create a .htaccess file under the web folder you want to password
protect (we assume it as secure) and put in the following contents.
## start of .htaccess
AuthName "Secure Access"
AuthType Basic
AuthUserFile /domains/wwwDOTicannbudgetDOTorg/web/secure/.htpasswd.users
AuthGroupFile /domains/wwwDOTicannbudgetDOTorg/web/secure/.htgroup
require group valid-users
## End of .htaccess
replace wwwDOTyourdomainDOTcom with wwwDOTicannbudgetDOTorg and
somefolder with the name of the web folder you want to pasword
protect.
2) Create .htpasswd.users & .htgroup file by using the following
command.
#touch /domains/wwwDOTicannbudgetDOTorg/web/secure/.htpasswd.users
#touch /domains/wwwDOTicannbudgetDOTorg/web/secure/.htgroup
3) Add users with the following command.
#/usr/local/apache/bin/htpasswd /domains/wwwDOTicannbudgetDOTorg/web/secure/.htpasswd.users
<username>
Replace <username> with the name of the user you want to add. It
will ask for password . Please enter them. Add as many users as you
want.
4) Create the group valid-users in .htgroup file.
Edit domains/wwwDOTicannbudgetDOTorg/web/secure/.htgroup and add the
following line.
valid-users: username1 usernam2
Replace username1, username2 with the users you have added in step3.
5) Test your setup. Open a browser and type in the url of the protected
web folder of your domain. For ex http://icannbudgetDOTorg/secure/.
Then a dialog box popups asking you to enter the username and password.
Enter them and see the results.
|