0

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 the 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

2
  • 1
    Is your AuthUserFile path intentionally /mobs/.htpasswd? What happens if you try to cat that path in a terminal? Commented Dec 2, 2009 at 13:16
  • I'll rephrase what Dominic was trying to say as you didn't seem to understand. /mobs/.htpasswd implies that this location exists from the root directory because of the leading forward-slash. Did you mean that? If not, what is the full path to the .htpasswd file? Commented Dec 2, 2009 at 13:57

3 Answers 3

6

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Agreed. With Apache errors, it's always best to check your log file to see what Apache says is going wrong.
1

Make sure that /mobs/.htpasswd is absolute (not relative to your webroot) path on your filesystem

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.