Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

19.7. mod_autoindex

The mod_autoindex module assists with automatic listings of server directory contents. This module can create icons and descriptions for each of the files in the directory, as well as display file content before and after the index itself.

AddAlt

AddAlt string filenames|suffixes ...

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies alternative text for icons used with a given file listing in a directory index. The alternative text is used if the client is unable to load the image for any reason or has disabled the display of images. The text is used as the first argument to the directive, followed by one or more file extensions or names. For example:

AddAlt "Image" .gif .jpg .png
AddAlt "Logo" logo.gif

See also FancyIndexing.

AddAltByEncoding

AddAltByEncoding string mime-encoding ...

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Similar to AddAlt, except that it specifies alternative text based on the MIME content encoding of the file being listed. For example, to specify the string "gzip" for a file encoded using the gzip compression program, the directive would be:

AddAltByEncoding "gzip" x-gzip

See also FancyIndexing.

AddAltByType

AddAltByType string mime-type ...  access.conf/<Directory>

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Similar to AddAlt, except that it specifies alternative text based on the media type of the file being listed. For example, to use the alt text "image" for all GIF files, the directive would be:

AddAltByType "image" image/gif

See also FancyIndexing.

AddDescription

AddDescription string file ...

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Used to associate a descriptive text phrase with a particular type of file. The text appears to the right of the filename in a directory index. The descriptive text must be surrounded by quotes and should be fairly short. Files can be associated by extension or name. For example:

AddDescription "GIF image file" .gif
AddDescription "The bottom of Hoover Dam" /home/user/vacation1.gif

See also FancyIndexing.

AddIcon

AddIcon icon name ...

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies an icon image to be displayed with a given type of file in a directory index. For example:

AddIcon /icons/image.gif .gif .jpg .png

An optional syntax lets you specify alternative text in this directive as well:

AddIcon (IMAGE,/icons/image.gif) .gif .jpg .png

Three values can be used for the file extensions in the AddIcon directive:

^^DIRECTORY^^
The icon is used for subdirectory names.

..
The icon is used for the parent directory.

^^BLANKICON^^
The icon is used only for spacing in the header of the page.

See also FancyIndexing.

AddIconByEncoding

AddIconByEncoding icon mime-encoding ...

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies an icon to be displayed with a file in a directory index based on the file's encoding. For example:

AddIconByEncoding /icons/gzip.gif x-gzip
AddIconByEncoding (GZIP,/icons/gzip.gif) x-gzip

See also FancyIndexing.

AddIconByType

AddIconByType icon mime-type

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies an icon to be displayed with a file in a directory index based on the file's media type. For example:

AddIconByType /icons/image.gif image/*
AddIconByType (IMAGE,/icons/image.gif) image/*

See also FancyIndexing.

DefaultIcon

DefaultIcon url  access.conf/<Directory>

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies the default icon to use when no icon image has been assigned by one of the AddIcon* directives.

See also FancyIndexing.

FancyIndexing

FancyIndexing on|off

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies that the server should create a fancy index for a directory listing, including filenames and icons representing the files' types, sizes, and last-modified dates. By default, fancy indexing is off. If it's on, the module looks to other directives in this module to determine how to display the directory.

HeaderName

HeaderName filename

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies a file to be inserted at the top of the listing when generating a directory index. The example file uses the following setting:

HeaderName index.html

The server looks for this filename first with an .html extension and, failing that, without an extension to display at the top of the directory index.

IndexIgnore

IndexIgnore filename ...

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Tells the server to ignore (hide) certain files when automatically building a directory index on the fly. The files are specified as full server paths, and you can use the wildcards * and ? with their usual meanings. Thus, to ignore all hidden files (i.e., files whose names begin with a period) at every level, you could use the following setting:

IndexIgnore */.?*

Any number of IndexIgnore directives may be included.

IndexOptions

IndexOptions option ...  access.conf/<Directory>

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies a number of options to use when creating a directory index on the fly. Possible options are:

FancyIndexing
Equivalent to FancyIndexing On. Unless fancy indexing is turned on by either method, the other index options (except None) are ignored.

IconsAreLinks
Make the icons link to the documents (in addition to making the names link).

IconWidth[=Pixels]
Include a WIDTH attribute in the image tag for the file icon.

IconHeight[=Pixels]
Include a HEIGHT attribute in the image tag for the file icon.

ScanHTMLTitles
Scan any HTML files in the directory, extract their titles, and use them as descriptions for the files.

SuppressLastModified
Omit the last-modified date from the fancy index.

SuppressSize
Omit the size from the fancy index.

SuppressDescription
Omit the description from the fancy index.

SuppressHTMLPreamble
Deactivate the automatic generation of HTML preambles that accompany the HeaderName.

ReadmeName

ReadmeName filename

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Specifies a file to be appended to the end of a file listing when generating a directory index. The example file uses the following setting:

ReadmeName README

The server looks for this filename first with an .html extension and, failing that, without an extension. In this case, it will find the file README with such an extension.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.