I wish to secure a directory on my webserver. I can't figure out how to do this with .htaccess and .htpasswd, not at all. My system is on OpenBSD and I have PHP support if that makes a difference.
u could try setting up an alais for it and deny all access...change this to meet ur requirement????
Alias /icons/ "C:/Program Files/Apache Group/Apache/icons/"
<Directory "C:/Program Files/Apache Group/Apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Deny from all
</Directory>
What you need it the following :
Use htpasswd to create a user file
htpasswd -c passwordfile username
the -c creates a new file
passwordfile is the path to your new password file
username is the name of the user you want to have access
you will be prompted to provide a password
A word of caution... do NOT use root as teh name... these names do not have to match the operating system, and should NOT as all http passwords travel the net in clear text UNLESS you use SSL
Once you have the passwordfile created...
in the directory that you want protected, place the following in an .htaccess file
AuthUserFile <Path To "passwordfile">
AuthName <username u created above>
AuthType Basic
<Limit GET>
require user "username"
</Limit>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.