tags:

views:

35

answers:

2

Hai

I want to protect a folder (protect) and the files inside that folder. I have created a .htaccess file and put the following code.

AuthName "Myfolder" AuthType Basic AuthUserFile url/protect/.htpasswd Require valid-user

Also created a .htpassword file which contain username:password

When I run my URL http://localhost/url/protect, I got a pop up asking username and password, I entered username as username and password as password. After that I got an error page "server error 500" "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster."

Why this happened?. Any thing wrong here? Anything needs to see my pages under the folder. Please give me the answer.

+1  A: 

.htpassword file must be created using htpasswd utility

also, AuthUserFile file path must be absolute.

And, aside from my guessing you should see the actual error explanation in the error_log file

Col. Shrapnel
A: 

What Col. Shrapnel said on the absolute path, here is a tutorial:

http://webdevelopment.kerryjones.net/security/htaccess-securing-a-folder/

Kerry