PDA

View Full Version : .htaccess problems


mrssfuller
08-31-2009, 10:26 PM
I have created a .htaccess file, and put in the directory in which i want to protect, and i created an .htpasswd file and put in the following path /usr/local/bin/ When I go live with it, the box comes up asking for the user name and password, but it is not accepting the password. any suggestions? (this is for a linux hosted website with godaddy)

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /usr/local/bin/.htpasswd
AuthGroupFile /dev/null
require valid-user


i've also tried (and anything else i can find on the net)

AuthUserFile /home/content/f/e/i/feislady/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Members Area"
AuthType Basic

require valid-user

clunk.werclick
09-13-2009, 10:59 AM
I tried this myself with Apache2 (Nothing better to do this weekend)

I created a file outside of the public root to hold my password file:
/home/www/experimental/passwd/passwd

I created a directory inside the public root that I wanted to password protect.
/home/www/experimental/htdocs/auth

I then used the htpasswd utility to create the user 'admin' with a password
...
htpasswd -c /home/www/experimental/passwd/passwd admin


New password:
Re-type new password:
Adding password for user admin


Finally, I edited the .htaccess file *inside of /auth* to look like this:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/www/experimental/passwd/passwd
Require user admin

This worked right out of the box with Apache2, no restart needed. I was prompted for a username and password when visiting /<site>/auth

Are you missing any of these steps or using a different Apache?