htaccess subfolder

Posted on 2005-04-11
Last Modified: 2008-01-09
I have an htaccess file that users login as a client.  All clients with a password can get to this folder.  I also want clients to have access to their own subfolder.  can I allow clients access to their own subfolder without a second login prompt while still narrowing the access to the subfolders so that all clients do not have access to all folders?
Question by:jimfrith
    LVL 24

    Expert Comment

    Oooo, fun.

    You are using Apache I presume?  On Windows or Linux?
    LVL 16

    Expert Comment

    If i understannd it correctly, each folder has its own .htaccess file. Each .htaccess file *can* specify a separate .htpasswd file or use a common one. So you can protect each folder as much or as little as you want. I'm not sure, however, if the way the browser cookies work mean that logging in to one folder as UserX means you can access a second folder as the same user without logging in again.

    I can feel an experiment coming along.
    LVL 24

    Expert Comment

    Well, htaccess files don't create cookies anyway, they cause the browser to authenticate with the server - which is nothing to do with cookies.  This means that if you have a Save Password option (Firefox does, as does Internet Destroyer... I mean, Explorer) that should be fine.
    LVL 24

    Accepted Solution

    Full details for htaccess are found here:

    Points worth noting btw, copied straight from Apache documentation:

    There are two main reasons to avoid the use of .htaccess files.

    The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, Apache will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.

    The second consideration is one of security. You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege. Note also that giving users less privileges than they need will lead to additional technical support requests. Make sure you clearly tell your users what level of privileges you have given them. Specifying exactly what you have set AllowOverride to, and pointing them to the relevant documentation, will save yourself a lot of confusion later.

    Note that it is completely equivalent to put a .htaccess file in a directory /www/htdocs/example containing a directive, and to put that same directive in a Directory section <Directory /www/htdocs/example> in your main server configuration:

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
    If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    729 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

    21 Experts available now in Live!

    Get 1:1 Help Now