目录列表的一个文件夹的htaccess [英] Directory listing for one folder htaccess

查看:131
本文介绍了目录列表的一个文件夹的htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经像一个文件夹结构:

I've a folder structure like:

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

我在大多数文件夹中已经默认文件(index.html的),但没有默认的文件的文件夹,我用选项-Indexes在家里的.htaccess生成一个403错误。在片段文件夹中,我使用自定义目录列表。

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>

里面的片段文件夹选项+索引规则。不过,我想prevent目录中的文件夹A,B,C的清单。是否有一个解决方案,它不需要一个htaccess文件,每个文件夹?我只能访问的htaccess

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

推荐答案

假设你有机会获得httpd.conf文件或虚拟主机配置,你可以添加目录的部分用通配符,或 DirectoryMatch 部分做到这一点在你的httpd.conf文件。你可能寻找一些类似:

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.

这篇关于目录列表的一个文件夹的htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆