0

I want to be able to password protect a specific directory but keep others free for anyone to access, but I've found out that when a directory is password protected by a .htaccess and .htpasswd file it disappears from apache's directory listing.

Is there any way to make the password protected directory appear among the other unprotected directories?

0

This may not be what you're after, but you could try limiting the .htaccess restrictions to files that are in the directory you wish to protect instead of protecting the directory itself.

  • But the problem is the directory is actually a webpage, and I want it so when I click on the directory and when it would normally redirect me to the index.php – user4191887 Jan 10 '16 at 21:11
0

Add the line

IndexOptions +ShowForbidden

to the .htaccess file in parent folder of your protected folder.

  • That doesn't work, the directory still does not appear – user4191887 Jan 11 '16 at 0:18
  • You need to have AllowOverride Indexes enabled for that directory. – Florian Diesch Jan 11 '16 at 0:24
  • IndexOptions ShowForbidden works just fine without the plus, why is that? – user4191887 Jan 11 '16 at 0:26
  • See the "Incremental IndexOptions" section at the end of the IndexOptions doc for the difference. Maybe there's a conflicting option somewhere. – Florian Diesch Jan 11 '16 at 0:36
0

Added IndexOptions ShowForbidden instead of IndexOptions +ShowForbidden

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.