Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I like the built in indexing that apache can do, I use it a lot to navigate certain files of mine. The problem I run into is that I normally leave a directory with no index.html so that I can view the index this way, but it allows the public to also view files in that directory (and I don't want them to).

Is there any way to put a password on all index.html/index.php that are non existent, so that all indexing is password protected? Or is there a way to say index.html or index.php is no longer what indexes a directory but say indexdir.html will run the code to index? Or even drop in a .htaccess file in certain directories I'd like to view for myself only.

share|improve this question

1 Answer 1

You can chance what file apache shows for the index using the DirectoryIndex directive. You can even provide a list of files that will be used in turn (if the first is not available, try the second, and so on).

You can also provide a file not in the same dir (i.e. a cgi-bin script that assembles an index).

If you use mod_autoindex you can also have various options for the automatic indexing that happens when no index files are found. Of course, autoindex only happens in folders you told apache to do so with the +Indexes option. Read more about mod_autoindex on apache documentation.

share|improve this answer
    
I've known about DirectoryIndex, I do not want to set an index, but rather use the indexing features you get when no index is present. a cgi-bin script that makes an index would be missing what I was looking for. mod_autoindex is nice but, i still only want ME to access index...in a public folder. When I say index, i dont mean the index (starting point) i mean the index (the actually indexing of directories). –  Brian Jul 25 '10 at 17:27
    
What you want is for you to access the directory listing (contents of the dir) and all other people to see the index (.html, .php or whatever)? Is that correct? –  coredump Jul 26 '10 at 0:56
    
yes That is correct coredump –  Brian Jul 27 '10 at 15:47
    
I don't know if you can conditionally enable directory index and mod_autoindex, you can make 2 alias to the same directory and enable the indexes only in one, but then you will have 2 different urls. –  coredump Jul 27 '10 at 20:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.