0
votes

I used .htaccess and .htpasswd to restrict the admin folder which is located at root/admin

for that i used the following

.htaccess file

AuthName "Alertalert"
AuthType Basic
AuthUserFile http://alertalert.freetzi.com/admin/.htpasswd
require valid-user 

.htpasswd file

rajasekar:$apr1$0yd92n1r$McIxIiQXPRF1u3gRBNRNc1

the .htaccess and .htpasswd file is located inside the admin folder.

When i try to access admin folder, it asks for username and password and thats ok. if I give correct username and password, its not accepting and so prompting again.

2
when i use it in local system using absolute path like c:/xampp/htdocs/admin/.htpasswd its working. but when i host it, its not workingRajasekar

2 Answers

4
votes

Check the documentation for the AuthUserFile directive. Its argument should be the path to the htpasswd file, not a URL.

1
votes

do you have any code in .htacess that prevents viewing of .htpasswd? Because you are going though HTTP, it may not be accessible. What about using the system path?

What about something like: AuthUserFile /var/admin/.htpasswd