Placing .htaccess file to the directory will hide it from the parent directory index. Simply said, directory with .htaccess file will be hidden by default in Apache 2.2 and later. To display directories with .htaccess file, document root (or subtree) should have set ShowForbidden index option. ShowForbidden is a new option in Apache 2.2 and it’s not set by default.
Here is how to make directories with .htaccess file visible:
# show directories containing .htaccess file IndexOptions ShowForbidden
This will show all directories and files but as list items (without icons). In this display it’s not so easy to distinguish directories and files (directory contains slash “/” at the name end). Therefore it is necessary to enable FancyIndexing (and HTMLTable) options also. Complete document root settings for Apache on my PC for testing purpose looks like:
<Directory "/var/www/html"> # default values for Options Options Indexes FollowSymLinks # show directories containing .htaccess file with fancy indexing as HTML table IndexOptions ShowForbidden FancyIndexing HTMLTable # enable .htaccess AllowOverride All # controls who can get stuff from this server. Order allow,deny Allow from all </Directory>
With this little tweak, Apache will display nicely all directories no matter if directory contains .htaccess file or not. Here is link to the IndexOptions Apache documentation where you will find other useful options like FoldersFirst, IconsAreLinks and others:
http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html#indexoptions