I'm running Apache2.2 on Ubuntu 10.04LTS. I can't seem to figure out how to have my password-protected directories show up in a directory listing. I am trying to create an environment where users can see all available directories, but have some of the directories password protected. When I add the AuthType, AuthName, AuthUserFile and Require options to either my virtual host or in a .htaccess file, the directory disappears from the listing. Is there a way to keep them visible? I'd prefer not to resort to scripting if I don't have to.
Thanks in advance.

6 Years
Discussion Span
Last Post by bsimms86

Try creating a .htaccess file in the folder you want to allow directory listing for. In that file add in your AuthType, etc - that way the user can click into the folder and when they do they'll then be prompted for the credentials.


I've done exactly what you suggest, if I'm understanding you correctly. I probably could have done a better job explaining my situation. In my web-root, I've got a folder named DOWNLOADS (with no index.html file inside of it) and within that folder are three sub-directories: SALES, MARKETING and FLYERS. Now, when I navigate to DOWNLOADS with my browser, I get a directory listing showing SALES, MARKETING and FLYERS. So far, so good. But when I either add a .htaccess file (with the AuthType and other options) to SALES, or add the AuthType and other options to my virtual host configuration, navigating to DOWNLOADS returns a directory listing showing MARKETING and FLYERS. SALES just disappears. Is this normal for password-protected directory?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.