I am trying to add Authentication window to a section of the site using .htaccess file.

But It is not working "the site is acting that the ".htaccess" files does not exists.

here is that content of my .htaccess file

AuthType Basic
AuthName "PHP MyAdmin"
AuthUserFile "c:/.htpasswd"
Require valid-user

the .htpasswd file is located on the C: drive.

and the .htaccess file is located inside a folder called dba so I want to secure the dba folder.

I have opned the httpd.conf file and updated the AllowOverride option from none to Indexed like this

<Directory />
     AllowOverride Indexed
     Require all denied

before this change this is how it was AllowOverride None Require all denied

How can i get the site to require a user authentication when someone tried to access the dba directory?

I have Apache 2.4.12 installed on Windows Server 2008 R2

1 Answer 1


Have you checked the file system permissions? I would like to think that the default user account running apache should not have access to c:/....


  • I just moved the file into the main path for php and it did not work also, AuthType Basic AuthName "PHP MyAdmin" AuthUserFile "c:/phpsites/.htpasswd" Require valid-user
    – Mike
    Apr 14, 2015 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .