9

Got a folder at http://myserver/folder/, I have disabled directory browsing for that folder.

But I want to enable directory browsing for the subfolders of http://myserver/folder/

How can I do this??

Thanks.

2
  • that was lame. :) read the question, "subfolders", meaning the folders inside myserver/folder/subfoldersarehere Commented Jul 13, 2011 at 22:22
  • 1
    Can you accept one of the answers so we can see what is working? For me @regilero solution is fine. Commented Jan 21, 2013 at 17:07

8 Answers 8

17

here's a working simple solution:

<Directory /path/to/docroot/folder> Options -Indexes </Directory> <DirectoryMatch /path/to/docroot/folder/(.)*/> Options +Indexes </DirectoryMatch> 
Sign up to request clarification or add additional context in comments.

2 Comments

I think you are missing some information in this answer. All I see is the code.
I believe this is not for htaccess, but if you have the rare privilege of having an open root access to the server which of course can be very dangerous.
10

If you do not control apache, you can do this in a per-directory basis in your own files adding .htaccess file in the corresponding directory containing

Options +Indexes 

Comments

1

Here is an option that you can use from .htaccess:

Options +Indexes RewriteRule ^$ - [F] 

2 Comments

I guess, my shared web host does not support <Directory> and <DirectoryMatch> in htaccess (used in the accepted solution). This helped me, thanks!
Crashed on my server too
0

You can just change the permissions of the respective folders. However, if you don't want to allow directory browsing at the /folder/ level, they'll need some link or way to get inward to the folders where you do allow browsing.

Comments

0

You can do this with an .htaccess file in each subfolder or at the top of each subfolder hierarchy. http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride ~ assuming apache

Comments

0

Your mileage might vary ...

.htaccess how no effect

neither did

Options +Indexes

but renaming index.html to _index.html display the files and folders in the browser

Comments

0

Another way is, if you have a directory you don't want browseable, create an empty index.html file in it, hopefully apache will pick that up and serve it instead :)

Comments

0

For any directory where you want to have the ability to list the directory, simply navigate there then execute this command:

echo "Options +Indexes" >.htaccess 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.