On my server, I want to create a directory hidden from normal users, but that is accessible with a link without authentication.
Currently I have set it up like this:
- In the virtual host configuration I have allowed Index options to be overridden
- On my server I have folder called
h
, as in hidden - On the same level with
h
I have a.htaccess
file with:IndexIgnore h
- And in h another
.htaccess
withIndexIgnore *
However, that also hides the contents of h/abc/
, which I don't want. I tried putting IndexIgnore .
in h/abc/.htaccess
, but it did not work. It is also stated in HTTPD Docs, which I learned later on:
Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the list contains . (the current directory).
Is there a way to specify the IndexIgnore
to only act on items inside the current directory, and not be recursive?
Or is there some kind of other, better way to deal with this? I would prefer not to touch the "global" configuration files too much, altough that is possible.
Placing the directory outside of your document root and creating an
Alias
would get you what you want. That is, assuming your document root is something like/var/www/html
, you would create/var/www/private
and then add (to your global -- sorry -- configuration):This directory would not show up in a list of files in
/
(because it's not contained in that directory), but it would work just fine if requested explicitly.