Forum Moderators: phranque

Message Too Old, No Replies

can we control how apache lists files?

server settings

         

dhx10000

9:06 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



Hi everyone,

First of all, I know very little about Apache servers so bear with my ignorance. We are running Apache/2.0.46 on a server. Hopefully, I can explain our problem correctly. If you go to a URL of a directory on the server that does NOT contain an Index.html page, the server displays the contents of the directory, I'm sure everyone has seen this. For example, I am looking at a URL right now and the headings say Name, Last modified, Size, Descprition. It seems that many, many people access this server and view its contents in this way. The problem is, a lot of files in these directories contain long file names that are getting cut-off. Is there anyway to tell Apache to allow for more characters in the file name to be shown?

If not, I know that I could create a PHP index page for each directory that would allow me to have control over the display of the contents of the directory. The problem is, this is not practical since I found out we have over 1 million directories.

Thank you for your help,

Sal

coopster

9:30 pm on Sep 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, dhx10000.

You are correct in that you can tell Apache the list of resources to look for when the client requests an index of the directory by specifying a / at the end of the directory name. This is set via the
Apache DirectoryIndex [httpd.apache.org] directive.

Also, have a read through the mod_autoindex [httpd.apache.org] module for more options.

dhx10000

11:20 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



thank you. I read the documentation and it looks like I need to locate the IndexOptions directive and play with that. The documentation says that the source file is called mod_autoindex.c. Can you give me a hint as to where this file can be found? The .c extension looks really strange to me.

jdMorgan

12:54 am on Sep 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Seems like you think this is more complicated than it actually is.

Re-read the mod_dir and mod_autoindex documentation with this in mind:

These modules define several directives which may be placed in either your httpd.conf (server configuration) file (if you are on a dedicated server), or in one or more .htaccess files in specific directories (if you are on shared hosting). You can use these directives to set the various parameters, such as column width, etc., that affect the directory listing format.

The documentation is heavly cross-linked, and you will likely need to follow several dozen of those links and read the target pages in order to get the big picture of how this all works. But don't let that scare you -- once you figure out which directives and settings you want, and where to put them, it's not difficult. And at the end, you'll be far more conversant with Apache configuration, making the next project easier...

The ".c" extension indicates a "C"-language source file. This source code file is compiled and linked into the Apache executable for custom builds. I seriously doubt you're going to need to -or want to-- learn a new programming language and how to use a compiler just to change the directory listing format! :)

Jim