Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to make an Apache server like this

Apache/1.3.41 Server at user.it.uu.se Port 80

display hidden files (i.e., those who start with a dot) in a specific directory? I have some configuration there that's accessible (no problem), only those files don't show when I navigate to that directory. (Of course, you could set up an HTML interface with links, etc., even automatize update, but I'd rather just view the files like any others.)

It's my school's server, so I can't configure it apart from putting a file in that directory, telling the server to override the habit of not showing hidden files. Is this something you normally do, and, if so, how?

The system, if it matters (with uname -a):

SunOS yxan.it.uu.se 5.10 Generic_147440-25 sun4u sparc SUNW,Sun-Fire-V240
share|improve this question
1  
I thought I'd tell you, this answer shows that this is indeed possible to configure (probably in /etc/apache2/conf.d/httpd.conf). But, I don't know how to add that as a "local exception" as is the case in my question. –  Emanuel Berg Dec 26 '12 at 21:08
add comment

3 Answers 3

Judging by the source code, it looks like it's hard coded to ignore dot files.

http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/src/modules/standard/mod_autoindex.c

if ((name[0] == '.') && (!name[1])) {
return (NULL);
}

Maybe someone else can tell differently...

share|improve this answer
3  
Hm, isn't that to ignore the current directory? Or what else do you make of the (!name[1]) part? –  Emanuel Berg Nov 15 '12 at 3:48
    
You very well may be right, but I think there's a different section earlier on dealing with that. Although admittedly, I'm no expert with C. –  bahamat Nov 15 '12 at 3:52
    
Emanuel, that's just for the current directory as you said. –  Jenny D Feb 21 '13 at 10:23
add comment

This PHP workaround does it:

<?php
   if ($handle = opendir('.')) {
     while (false !== ($entry = readdir($handle))) {
       if ($entry != "." && $entry != ".." &&
           $entry != "index.php") {
         echo "<p><a href='$entry'>$entry</a></p>";
       }
     }
     closedir($handle);
   }
?>

See it in action here.

share|improve this answer
add comment

You can't remove files from the IndexIgnore in a local directory. But you can remove them from the global IndexIgnore line, and then use a second IndexIgnore directive inside the <Directory> context for those directories where you do want to keep the files hidden.

Here are the docs for mod_autoindex.

share|improve this answer
    
OK, how about giving me an example (at least) to modify so I can try it? If it works, I'll accept your answer because it really is an answer, not a workaround as the solution I provided. –  Emanuel Berg Mar 1 '13 at 22:11
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.