0

My httpd.conf file looks like:

<Directory "/path/to/mysite">
    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile "/path/to/.htpasswd"
    Require user valid-user

    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny
    Allow from all
</Directory>

I generated my .htpasswd file using the htpasswd command: $ htpasswd ~/.htpasswd myuser

So now when I restart apache, it prompts for a username and password, however, when I type in my username and password, it just prompts again. Any help would be appreciated.

Thanks

My .htpasswd file looks like: myuser:$aaa1$rsU3A8zu$1xiIou2elcL3QLIPhzsaj0

Shamoon
  • 911
  • 4
  • 14
  • 22

1 Answers1

-1

I am no Apache expert, so there may be other ways of doing this... Although the documentation states that it should work just fine..

But instead of having the Auth directives in a <Directory> block, try instead adding them to a <Location /<insert location here> block. Like this:

<Location />
    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile .htpasswd
    Require user valid-user
</Location>
Jenny D
  • 27,780
  • 21
  • 75
  • 114
espenfjo
  • 1,686
  • 2
  • 13
  • 15
  • Instead of `/`, should I use my path? – Shamoon Jun 25 '13 at 14:03
  • Path seen from the web servers side. Not `/var/www/html/secret`, but `/secret` if that is the page that the clients go to. – espenfjo Jun 25 '13 at 14:15
  • Tried that - negative – Shamoon Jun 25 '13 at 19:18
  • The difference between Location and Directory is that Directory is used for a place in the file system, whereas Location matches on the URL (whether or not that matches an actual place in the file system). Just switching from one to the other without an actual reason is very unlikely to be at all helpful. – Jenny D Jun 27 '13 at 08:53