• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

can't get password protected directories working with htaccess.


I am trying to get password protected directories working with Apache 2 on my Windows Development Server.

I can't.

I have a .htaccess file (actually it is called htaccess at the moment for windows but I have tried both) and a passwords file. My htaccess file contains the following:

AuthType Basic
AuthName "Administrator access only"
AuthUserFile passwords
AuthGroupFile /dev/null
require user root

I put my passwords file in the same directory as htaccess to make sure it was not a path problem. I have also tried various paths.

My passwords file contains the following:


And I have this in my httpd.conf:

ServerRoot "C:/server/Apache2"

LoadModule auth_module modules/mod_auth.so

DocumentRoot "C:/server/Apache2/htdocs"

AccessFileName .htaccess

I have no idea how to get this working which is annoying as its very much needed.
  • 3
1 Solution
> AuthUserFile passwords
> AuthGroupFile /dev/null

is not valid. It must contain the full physical path to your file:

AuthUserFile "C:/server/path/to/password/file/.htpasswd"

Don't use "AuthGroupFile" unless you need a Group file. Just remove that line.
ralphuk100Author Commented:
I have changed it to:

AuthType Basic
AuthName "By Invitation Only"
AuthUserFile c:/server/Apache2/passwd/passwords
require user root

And still nothing happens...Just so you know I have the path write here is a screen grab:


Any other ideas? Have I got something wrong in my httpd.conf file? Thanks.
ralphuk100Author Commented:
I have also changed the AllowOverride directive to AuthConfig and that has not made a difference.
ralphuk100Author Commented:
I have now solved this problem. Please do not provide any more answers. I propose asking for 50 points to be given to you for the useful advice and the remainder returned to me. Agreeable?

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now