can't get password protected directories working with htaccess.

Posted on 2005-04-16
Last Modified: 2010-03-04

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/

DocumentRoot "C:/server/Apache2/htdocs"

AccessFileName .htaccess

I have no idea how to get this working which is annoying as its very much needed.
Question by:ralphuk100
    LVL 27

    Accepted 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.

    Author Comment

    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.

    Author Comment

    I have also changed the AllowOverride directive to AuthConfig and that has not made a difference.

    Author Comment

    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?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now