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.

Recommended Answers

All 2 Replies

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.