when I use .htaccess file inside a folder named admin with the following code
AuthName "Alertme"
AuthType Basic
AuthUserFile /mobs/.htpasswd
require valid-user
and .htpasswd file with following code
rajasekar:66Acdia7gE1to
While accessing 开发者_如何学JAVAthe file inside folder, it gives server error, The server encountered an internal error and was unable to complete your request
why is this happening. help me
Most likely your Apache config does now allow Auth* directives in .htaccess in that directory and/or location. You can check for sure why looking in the error_log for that host. There'll be a line that looks like:
[Wed Dec 02 22:13:14 2009] [alert] [client x.x.x.x] /path/leading/to/.htaccess: AuthName not allowed here
This error will show up as a "500 Internal Server" error for any client attempting to access that particular server/directory.
You will need to add an "AllowOverride AuthConfig" so Apache will accept the Auth directives in the .htaccess. Details are here in the Apache docs.
Make sure that /mobs/.htpasswd is absolute (not relative to your webroot) path on your filesystem
This usually happens when your htaccess and/or htpasswd file can't be read by apache. Either because the user apache is running under doesn't have the needed rights on these files.
精彩评论