Home Index

Welcome, Guest
Welcome, Guest. Please login or register.
February 04, 2012, 01:24:59 pm
Search:  
Advanced search
WJD Forum Index  |  WestHost Related  |  .htaccess Files  |  Topic: Displaying the contents of a directory.
Pages: [1] |   Go Down
Print
Author Topic: Displaying the contents of a directory.  (Read 6299 times)
Shawn Sorrell
Administrator
Jr. Member
*****
Offline

Gender: Male
Posts: 64



WWW
« on: November 29, 2003, 11:27:24 am »

Some times you may not what to use an index.html file in a directory but simply display what is in that directory.  To do that create a .htaccess file that has the following in it.
Code:
Options +Indexes


Save the file and upload it to the directory you want.  All files and sub directories will be now be displayed.
Logged

Shawn Sorrell
Remember I am not an expert but a jack of all trades.  Information posted here should be used at your own risk. You are responsible for any changes you make to your account/website.
Shawn Sorrell
Administrator
Jr. Member
*****
Offline

Gender: Male
Posts: 64



WWW
« Reply #1 on: November 22, 2004, 05:29:12 pm »

You can also control how things are indexed further either in the .htaccess file or by modifying your httpd.conf file that is located in the /etc/httpd/conf directory. If you look in that file you'll see an area that looks like this:
Code:

<IfModule mod_autoindex.c>

    #
    # FancyIndexing is whether you want fancy directory indexing or standard
    #
    IndexOptions FancyIndexing NameWidth=*

    #
    # AddIcon* directives tell the server which icon to show for different
    # files or filename extensions.  These are only displayed for
    # FancyIndexed directories.
    #
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^

    #
    # DefaultIcon is which icon to show for files which do not have an icon
    # explicitly set.
    #
    DefaultIcon /icons/unknown.gif

    #
    # AddDescription allows you to place a short description after a file in
    # server-generated indexes.  These are only displayed for FancyIndexed
    # directories.
    # Format: AddDescription "description" filename
    #
    #AddDescription "GZIP compressed document" .gz
    #AddDescription "tar archive" .tar
    #AddDescription "GZIP compressed tar archive" .tgz

    #
    # ReadmeName is the name of the README file the server will look for by
    # default, and append to directory listings.
    #
    # HeaderName is the name of a file which should be prepended to
    # directory indexes.
    #
    # If MultiViews are amongst the Options in effect, the server will
    # first look for name.html and include it if found.  If name.html
    # doesn't exist, the server will then look for name.txt and include
    # it as plaintext if found.
    #
    ReadmeName README
    HeaderName HEADER

    #
    # IndexIgnore is a set of filenames which directory indexing should ignore
    # and not include in the listing.  Shell-style wildcarding is permitted.
    #
    # HEADER* README* RCS CVS *,v *,t
    IndexIgnore .??* *~

</IfModule>


You can learn more about this module and how to modify it here:
http://httpd.apache.org/docs/mod/mod_autoindex.html

Some clients on WH have had problems with this module and have discovered that in the httpd.conf file at the very end of the above code there is something like this:
Code:
IndexIgnore .??* *~  *

The difference between the first example of code and this one is the last singular * which includes all files in the ignore list.  If you find this to be so then you can delete it and Indexing should work.

NOTE: Please remember that when modifying the httpd.conf file that you should always make a back up of the original and that after you make the changes you need to restart the VPS or apache to have them take effect.  If you simply add directives to an .htaccess file there is no need to restart.  I can't be responsible for changes you make to your httpd.conf file so make sure to research what you are doing fully.
Logged

Shawn Sorrell
Remember I am not an expert but a jack of all trades.  Information posted here should be used at your own risk. You are responsible for any changes you make to your account/website.
torrin
Newbie
*
Offline

Posts: 5


WWW
« Reply #2 on: February 01, 2005, 11:45:20 am »

Thanks for the tip.  I had forgotten about this.
Logged
Pages: [1] |   Go Up
Print
WJD Forum Index  |  WestHost Related  |  .htaccess Files  |  Topic: Displaying the contents of a directory.
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC