使用HideFiles参数进行配制就可以了。
看到有人说这样用:
HideFiles (.*)
似乎不太符合正则表达式的写法,
我感觉应该写成这个样子:HideFiles ^(\.)
没有验证行不行。回去试试。
还要配合使用HideNoAccess、IgnoreHide
不过我试了半天也没有试验成功。郁闷。
HideFiles [ [!]regexp|"none" ["user"|"group"|"class" expression]
]
Default
None
Context
<Directory>, .ftpaccess
Module
mod_core
Compatibility
1.2.7rc1 and later
The HideFiles directive configures a <Directory> section to hide all directory entries, e.g. its files and sub-directories, that match the given regular expression. These files can still be operated on by other FTP commands (DELE, RETR, etc), as constrained by any applicable <Limit>s, but this can be modified using the IgnoreHidden directive. Note that this directive manipulates a file's "hidden-ness", but doesn't do any hiding by itself. A <Limit> section, with IgnoreHidden enabled, does the actual hiding of the files from the <Limit>ed commands.
As <Directory> configurations are inherited by sub-directories, the "none" parameter can be used to disable any inherited file hiding within a sub-directory, usually through the use of a .ftpaccess file.
The optional parameters are used to restrict the rule for hiding files only to specific users. If "user" restriction is given, then expression is a user-expression specifying to which users the rule applies. Similarly for the "group" restriction. For the "class" restriction, the expression is simply the name of connection class for whom the rule will apply.
An unrestricted HideFiles directive and an unrestriected ShowFiles directive cannot be used simultaneously in the same context.
# Hide configuration and passwd files from view HideFiles "(\\.conf|passwd)$" # ...or the same regex, without the quotes HideFiles (\.conf|passwd)$ # Hide those same files from everyone _except_ a special user HideFiles (\.conf|passwd)$ user !tj # Using the ! prefix to "invert" the regular expression matching, # allow only .txt and .html files to be seen HideFiles !(\.txt|\.html)$ # Only let users of the webmaster group see HTML files, but nothing else HideFiles !(\.htm|\.html)$ group webmaster
See Also: HideGroup, HideUser, HideNoAccess