DobotJr
DobotJr

Reputation: 4049

Subfolder directory browsing in Apache2

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.

Upvotes: 9

Views: 35657

Answers (8)

SDsolar
SDsolar

Reputation: 2705

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

Upvotes: 0

rogerdpack
rogerdpack

Reputation: 66741

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 :)

Upvotes: 0

William Entriken
William Entriken

Reputation: 39253

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

Options +Indexes
RewriteRule ^$ - [F]

Upvotes: 1

robor
robor

Reputation: 3089

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

Upvotes: 0

Nicolás Wolovick
Nicolás Wolovick

Reputation: 348

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

Upvotes: 10

regilero
regilero

Reputation: 30496

here's a working simple solution:

<Directory /path/to/docroot/folder>
        Options -Indexes
</Directory>
<DirectoryMatch  /path/to/docroot/folder/(.)*/>
        Options +Indexes
</DirectoryMatch>

Upvotes: 17

Sean Kimball
Sean Kimball

Reputation: 4494

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

Upvotes: 0

user825607
user825607

Reputation:

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.

Upvotes: 0

Related Questions