Search code examples
apache.htaccess.htpasswd

.htaccess doesn't ask me for password


I'm trying to protect a directory adding a .htaccess and a .htpasswd but instead asking me for password, it goes to the home page of my site directly.

My .htaccess is being read (put some garbage in it and I got 500 error).

Here's my .htaccess :

AuthName "Page d'administration protégée"
AuthType Basic
AuthUserFile "/Applications/MAMP/htdocs/backoffice_mollanger/app/.htpasswd"
Require valid-user

And my .htpasswd

Admin:gl0IiOirI2n6M

Solution

  • First of all, remove the speech marks you have around the .htpasswd location, they should not be there. If that does not help then try using this, you can specify the directory you want to protect by stating the file name in replace of example:

    <Files /example>
    AuthName "Page d'administration protégée"
    AuthType Basic
    AuthUserFile /Applications/MAMP/htdocs/backoffice_mollanger/app/.htpasswd
    Require valid-user
    </Files>