开发者

Directory listing for one folder htaccess

I've a folder structure like:

        home
         |
snippets---other----bla
   |        |        |
a--b--c   d--e--f  g--h--i
|  |  |   |  |  |  |  |  |
filesfilesfilesfilesfilesfiles

I've default files (index.html) in most folders, but for the folders without default files, I used "Options -Indexes" in the home .htaccess to generate a 403 error. In the snippets folder, I use custom directory listing.

<IfModule mod_autoindex.c>
    Options +Indexes
    IndexOptions IgnoreCase VersionSort SuppressHTMLPreamble
    ReadmeName ../index_end.html
    HeaderName ../index_begin.html
</IfModule>

Inside the snippets folder Options +Indexes rules. However, I want to prevent directory listing in fo开发者_JAVA技巧lder a,b,c. Is there a solution which doesn't needs an htaccess file for every folder? I only have access to htaccess


Assuming you have access to the httpd.conf file or your virtual host configuration, You can add Directory sections with Wildcards, or DirectoryMatch sections to accomplish this in your httpd.conf file. You're probably looking for something akin to:

<Directory /home/snippets/*>
    Options -Indexes
</Directory>

Make sure you read up on how various configuration settings are merged.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜