How to configure the access password lifetime in Apache?

Posted on 2011-10-25
Last Modified: 2012-05-12
With the Apache web server, the access to a particular directory can be password protected by placing a suitable .htaccess file in the dir.

That works OK for me, but the password is only requested once per browser session. Well, I'm dealing with sensitive data and I'm paranoid about it too.
Can the the timeout for re-requiring the password be configured? Could the lifetime even be zero, so that a password is required every time the URL is accessed?
Question by:Phazz
    LVL 19

    Accepted Solution

    That's unfortunately one of the limitations of basic .htaccess - the clients are literally authorized until their web browsers close.

    For true security, you will want to do something more sophisticated.  Here's a nice example:


    Author Closing Comment

    Thanks! Man, that's complex indeed.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
    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…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now