.htaccess directory listing

By Rabbit
Oct 1, 2005
  1. Hello!

    I'm not sure if I'm at the right place to ask this question, but you all have been pretty nice in the past, so I thought I'd see if anyone has any information about my problem.

    I want all the files in an apache based web directory to be accessible through hyperlinks when a browser is pointed to that directory (i.e. a directory listing) and I used a .htaccess file to do this by using the command: Options +Indexes

    Doing that worked, but one annoying thing is that the generic directory list index file that is created truncates the file names.
    For example, if the file name is "this_is_the_file_name.doc" the generated index link for that file might appear as, "this_is_the_fi..>"
    This can be really annoying if all the file names are basically the same except for a number at the very end, (i.e. filename001.doc filename002.doc filename003.doc, etc.) Of course moving the mouse pointer over the link shows the full filename in the IE infobar, but for novice visitors, that may not be obvious.

    I just want to know if there are any ways I can force the server to show the full file name when generating links for a directory view. Hopefully by another parameter in the .htaccess file, perhaps?

    I can only make changes to files in my own user web folder, so I can't make any changes to the main server files or anything "upstream" if you know what I mean. The sever on which my files are stored is Apache/2.0.54 as far as I know.

    If there isn't a way to fix this, does anyone happen to know of a free program that might generate a "directory listing" index file for a given directory and subdirectories that does show the full file name in the generated links? I want to avoid using a program if at all possible so that I don't have to generate a new index file each time I update a folder or file, but I guess it might be something to look into.

    Thanks for your help!

  2. Rabbit

    Rabbit TS Rookie Topic Starter

    Gosh, I feel really silly now... I just now figured out one solution to my own problem :blush:

    I'll post my solution here though so if anyone else has the same problem they can refer to this thread:

    The "options +Indexes" .htaccess command will allow a directory to be viewed, but it also shows attributes such as "file size" and "date" because by default it is in the "fancy view." When it tries to show this additional information, to make room for it all, it has to truncate the file name when making links.

    One way around this, if you don't mind sacrificing the addition information about file size, date and fun little icons is to turn off the "fancy" view by adding the following command to the directory's .htaccess file: IndexOptions -FancyIndexing

    With fancy mode turned off, the full file name is shown at the expense of file size, date, and file type icons. (If you ask me, the nonfancy mode looks cleaner. The only thing that might be confusing for a novice visitor is that folders in the nonfancy mode show up as "Foldername/" and novice users might not realize that "/" means "folder" where as in fancy mode, folders have a handy folder icon next to them that most users will recognize.)

    If anyone has a better solution (i.e. one that retains the icons but still shows the full file name) please continue this discussion because that would be ideal!

  3. RealBlackStuff

    RealBlackStuff TS Rookie Posts: 6,503

Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...