1

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 with IndexIgnore *

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.

1 Answer 1

2

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):

Alias /private/ /var/www/private/ 

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.

2
  • Is it possible to do it so that you can not see the contents of /private/, but you can see /private/abc/? So I could just create multiple "private folders" for different people, or would I have to alias them separately? Commented Mar 7, 2013 at 19:38
  • You could get the behavior you want with more Alias directives, certainly. I'm still a little fuzzy on your actual use case, so I may be providing the best answer. Commented Mar 7, 2013 at 20:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.