Module mod_autoindex

Important: Information for this topic supports the latest PTF levels for HTTP Server for i5/OS . It is recommended that you install the latest PTFs to upgrade to the latest level of the HTTP Server for i5/OS. Some of the topics documented here are not available prior to this update. See http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm Link outside Information Center for more information.

Summary

The module mod_autoindex provides for automatic directory indexing. The index of a directory can come from one of two sources:

If the FancyIndexing keyword is present on the IndexOptions directive, the column headers are links that control the order of the display. If you select a header link, the listing will be regenerated, sorted by the values in that column. Selecting the same header repeatedly toggles between ascending and descending order.

For all mod_autoindex directives that specify a file name (AddDescription, AddIcon, and so on), case sensitivity is handled based on the file system. If the object is in the QOpenSys file system, the name is handled in a case sensitive manner. If the object is a file system other than QOpenSys, the name is handled in a case insensitive manner.

Note: When the display is sorted by "Size", it is the actual size of the files that's used, not the displayed value - so a 1010-byte file will always be displayed before a 1011-byte file (if in ascending order) even though the size of both files could be displayed as "1K".

Directives

AddAlt

Module: mod_autoindex
Syntax: AddAlt string file [file...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddAlt "IMG" jpg gif

The AddAlt directive sets the alternate text to display for automatic directory indexing.

Parameter One: string
  • The string parameter is enclosed in double quotes ("..."). This alternate text is displayed if the client is image-incapable or has image loading disabled.
Parameter Two: file
  • The file parameter is either ^^DIRECTORY^^ for child directories, ^^PARENT^^ for parent directories, ^^BLANKICON^^ for blank lines (to format the list correctly), a file extension, a wildcard expression, a partial file, or a complete filename. It could also be a QSYS.LIB member type if this directive is being used to set alternate text for QSYS.LIB members. For example:
    AddAlt "IMG" .jpg .gif
    AddAlt " " ^^BLANKICON^^
    AddAlt "BAK" *~ 
Note: This directive is not supported in <Location> containers.

AddAltByEncoding

Module: mod_autoindex
Syntax: AddAltByEncoding string MIME-encoding [MIME-encoding...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddAltByEncoding "CMP" x-compress

The AddAltByEncoding directive sets the alternate text to display for a file, instead of an icon, for automatic directory indexing.

Parameter One: string
  • The string parameter is enclosed in double quotes ("..."). This alternate text is displayed if the client is image-incapable or has image loading disabled.
Parameter Two: MIME-encoding
  • The MIME-encoding parameter is a valid content-encoding, such as x-compress.
Note: This directive is not supported in <Location> containers.

AddAltByType

Module: mod_autoindex
Syntax: AddAltByType string MIME-type [MIME-type ...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddAltByType "HTM" text/html

The AddAltByType directive sets the alternate text to display for a file, instead of an icon, for automatic directory indexing.

Parameter One: string
  • The string parameter is enclosed in double quotes ("..."). This alternate text is displayed if the client is image-incapable or has image loading disabled.
Parameter Two: MIME-type
  • The MIME-type parameter is a valid content-type, such as text/html.
Note: This directive is not supported in <Location> containers.

AddDescription

Module: mod_autoindex
Syntax: AddDescription string file [file...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddDescription "Famous People" /web/pics/famous*
Example: AddDescription "My pictures" /QSYS.LIB/MYLIB/MYFILE.FILE/pic*

The AddDescription directive sets the description to display for a file, for automatic directory indexing. File is a file extension, partial filename, QSYS.LIB member type, wildcard expression or full filename for files to describe. String is enclosed in double quotes ("). For example:

AddDescription "The planet Mars" /web/pics/mars.gif

By default, the description field is 23 bytes wide. Seven more bytes may be added if the directory is covered by an IndexOptions SuppressSize, and 19 bytes may be added if IndexOptions SuppressLastModified is in effect. The widest this column can be is therefore 49 bytes, unless configured differently using IndexOptions DescriptionMaxWidth.

The DescriptionWidth IndexOptions keyword allows you to adjust this width to any arbitrary size.

The following order of precedence will be used to search for a directory listing file description. The first mechanism from this list that applies will be used to generate the file description:

  1. The file matches one of those specified on an AddDescription directive. The string from the directive is displayed. This option is the least CPU intensive.
  2. The file system contains a description for the file. The file system description information is displayed. Note that if the file is a QSYS.LIB member, the member text is displayed.
  3. If IndexOptions ScanHTMLTitles is configured, the title is extracted from HTML documents for fancy indexing. This is CPU and disk intensive.
Note: Descriptive text defined with AddDescription may contain HTML markup, such as tags and character entities. If the width of the description column should happen to truncate a tagged element (such as cutting off the end of a bold phrase), the results may affect the rest of the directory listing. This directive is not supported in <Location> containers.

AddIcon

Module: mod_autoindex
Syntax: AddIcon icon name [name ...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddIcon (IMG,icons/image) .gif .jpg

The AddIcon directive sets the icon to display next to a file ending in name for automatic directory indexing.

Parameter One: icon
  • The icon parameter is either a (%-escape) relative URL to the icon or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers.
Parameter Two: name
  • The name parameter is either ^^DIRECTORY^^ for child directories, ^^PARENT^^ for parent directories, ^^BLANKICON^^ for blank lines (to format the list correctly), a file extension, a wildcard expression, a partial file or a complete filename. For example
    AddIcon (IMG,icons/image) .gif .jpg 
    AddIcon (PAR, icons/parent .gif) ^^PARENT^^ 
    AddIcon /dir.gif ^^DIRECTORY^^ 
    AddIcon backup.gif *~ 

AddIconByType should be used in preference to AddIcon, when possible.

Note: This directive is not supported in <Location> containers.

AddIconByEncoding

Module: mod_autoindex
Syntax: AddIconByEncoding icon MIME-encoding [MIME-encoding ...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddIconByEncoding /compress.xbm x-compress

The AddIConByEncoding directive sets the icon to display next to files with MIME-encoding for automatic directory indexing.

Parameter One: icon
  • The icon parameter is either a (%-escaped) relative URL to the icon or of the format (alttext,url) where alttext is the text tag five for an icon for non-graphical browsers.
Parameter Two: MIME-encoding
  • The MIME-encoding parameter is a wildcard expression matching required content-encoding.
Note: This directive is not supported in <Location> containers.

AddIconByType

Module: mod_autoindex
Syntax: AddIconByType icon MIME-type [MIME-type ...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: AddIconByType (IMG,image.gif) image/*

The AddIconByType directive sets the icon to display next to files of type MIME-type for FancyIndexing. Icon is either a (%-escaped) relative URL to the icon, or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers.

Parameter One: icon
  • The icon parameter is either a (%-escaped) relative URL to the icon or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers.
Parameter Two: MIME-type
  • The MIME-type parameter is a wildcard expression matching the required MIME types.
Note: This directive is not supported in <Location> containers.

DefaultIcon

Module: mod_autoindex
Syntax: DefaultIcon url
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Modified
Example: DefaultIcon /icon/unknown.gif

The DefaultIcon directive sets the icon to display for files when no specific icon is known, for automatic directory indexing.

Parameter: url
  • The url parameter is either a (%-escaped) relative URL to the icon or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers. For example:
    DefaultIcon (UNK,unknown.gif)
Note: This directive is not supported in <Location> containers.

HeaderName

Module: mod_autoindex
Syntax: HeaderName filename
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: HeaderName headerfile
Example: HeaderName PREAMBLE.MBR

The HeaderName directive sets the name of the file that will be inserted at the top of the index listing.

Parameter: filename
  • The filename parameter is the name of the file to include.

Filename is treated as a URI path relative to the one used to access the directory being indexed, and must resolve to a document with a major content type of "text" (for example, text/html, text/plain). This means that filename may refer to a CGI script if the script's actual file type (as opposed to its output) is marked as text/html such as with a directive like:

AddType text/html .cgi

Content negotiation will be performed if the MultiViews option is enabled. See Content negotiation for HTTP Server (powered by Apache) for more information.

If filename resolves to a static text/html document (not a CGI script) and the Includes Option is enabled, the file will be processed for server-side includes. See mod_include for more information.

See also ReadmeName.

Note: This directive is not supported in <Location> containers.

IndexIgnore

Module: mod_autoindex
Syntax: IndexIgnore file [file ...]
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: IndexIgnore README .htaccess
Example: IndexIgnore README.MBR

The IndexIgnore directive adds to the list of files to hide when listing a directory. Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the dot directory (.) is ignored.

Parameter: file
  • The file parameter is a file extension, QSYS.LIB member type, partial filename, wildcard expression or full filename for files to ignore.
Note: This directive is not supported in <Location> containers.

IndexOptions

Module: mod_autoindex
Syntax: IndexOptions [+|-]option [+|-]option ...
Default: none
Context: server config, virtual host, directory, .htaccess
Override: Indexes
Origin: Apache
Example: IndexOptions FancyIndexing ShowOwner FoldersFirst

The IndexOptions directive specifies the behavior of the directory indexing.

Parameter: option
  • The option parameter can be one of the following:
    Parameter Description
    DescriptionWidth= [n]
    • The DescriptionWidth keyword allows you to specify the width of the description column in characters.
    • -DescriptionWidth (or unset) allows mod_autoindex to calculate the best width.
    • DescriptionWidth=n fixes the column width to n characters wide.
    • DescriptionWidth=* grows the column to the width necessary to accommodate the longest description string.
    See AddDescription for information on truncating.
    FancyIndexing This turns on fancy indexing of directories. With FancyIndexing, the column headers are links that control the order of the display. If you select a header link, the listing will be regenerated, sorted by the values in that column. Selecting the same header repeatedly toggles between ascending and descending order.
    Note: When the display is sorted by "Size", it is the actual size of the files that's used, not the displayed value. Regardless of the ShowSmallFileBytes option setting, a 1010-byte file will always be displayed before a 1011-byte file (if in ascending order) even though the size of both files could be displayed as "1K".
    FoldersFirst If this option is enabled, subdirectories in a FancyIndexed listing will always appear first, followed by normal files in the directory. The listing is broken into two components, the files and the subdirectories, and each is sorted separately and then displayed (subdirectories-first). For instance, if the sort order is descending by name, and FoldersFirst is enabled, subdirectory Zed will be listed before subdirectory Beta, which will be listed before normal files Gamma and Alpha. This option only has an effect if FancyIndexing is also enabled.
    IconsAreLinks This makes the icons part of the anchor for the filename, for fancy indexing.
    IconHeight=[pixels] Presence of this option, when used with IconWidth, will cause the server to include HEIGHT and WIDTH attributes in the IMG tag for the file icon. This allows browser to precalculate the page layout without having to wait until all the images have been loaded. If no value is given for the option, it defaults to the standard height of the icons supplied with HTTP Server software.
    IconWidth=[pixels] Presence of this option, when used with IconHeight, will cause the server to include HEIGHT and WIDTH attributes in the IMG tag for the file icon. This allows browser to precalculate the page layout without having to wait until all the images have been loaded. If no value is given for the option, it defaults to the standard width of the icons supplied with HTTP Server software.
    IgnoreClient This option causes mod_autoindex to ignore all query variables from the client, including sort order (implies SuppressColumnSorting).
    NameWidth=[n | *]
    • The NameWidth keyword allows you to specify the width of the filename column in characters. If the keyword value is '*', then the column is automatically sized to the length of the longest filename in the display.
    • NameWidth (or unset) allows mod_autoindex to calculate the best width.
    • NameWidth=n fixes the column width to n characters wide.
    • The minimum value allowed is 5.
    NameMinWidth=[n] The NameMinWidth keyword allows you to specify the minimum width that will always be reserved for the filename column in characters. The default setting is 15. The minimum value allowed is 5. If NameMinWidth is greater than NameWidth, then the filename column will have a length=NameMinWidth.
    ScanHTMLTitles This enables the extraction of the title from HTML documents for fancy indexing. If the file does not have a description given by AddDescription then HTTP Server will read the document for the value of the TITLE tag. This is CPU and disk intensive.
    SelectiveDirAccess This option causes the server to return directory listings only for directories that contain a wwwbrws file. The contents of the wwwbrws file are not important. The server only checks for its existence. The object is a member name of an i5/OS™ physical file or a type of object in an integrated file system directory. For case-sensitive file systems such as /QOpenSys, the wwwbrws name is lowercase.

    Note: SelectiveDirAccess is an i5/OS specific option. This specific option works on a per directory basis. You must specify the ± SelectiveDirAccess on a Directory container.

    ShowOwner This determines whether directory listings should include the owner ID for each file.
    SuppressColumnSorting If specified, HTTP Server will not make the column headings in a FancyIndexed directory listing into links for sorting. The default behavior is for them to be links; selecting the column heading will sort the directory listing by the values in that column.
    SuppressDescription This will suppress the file description in fancy indexing listings. See AddDescription for information about setting the file description. See also the DescriptionWidth index option to limit the size of the description column.
    SuppressHTMLPreamble If the directory actually contains a file specified by the HeaderName directive, the module usually includes the contents of the file after a standard HTML preamble (<HTML>, <HEAD>, and so on). The SuppressHTMLPreamble option disables this behavior, causing the module to start the display with the header file contents. The header file must contain appropriate HTML instructions in this case. If there is no header file, the preamble is generated as usual.
    SuppressIcon This suppresses the display of icons on directory listings. The default is that no options are enabled.
    SuppressLastModified This will suppress the display of the last modification date, in fancy indexing listings.
    SuppressRules This will suppress the horizontal rule lines (HR tags) in directory listings. Combining both SuppressIcon and SuppressRules yields proper HTML 3.2 output, which by the final specification prohibits IMG and HR tags from the PRE block (used to format FancyIndexed listings).
    SuppressSize This will suppress the file size in fancy indexing listings.
    TrackModified This returns the Last-Modified and ETag values for the listed directory in the HTTP header. It is only valid if the operating system and file system return appropriate stat() results. Some UNIX® systems do so, as do OS/2's JFS and Win32's NTFS volumes. OS/2® and Win32 FAT volumes, for example, do not. Once this feature is enabled, the client or proxy can track changes to the list of files when they perform a HEAD request. Note some operating systems correctly track new and removed files, but do not track changes for sizes or dates of the files within the directory. Changes to the size or date stamp of an existing file will not update the Last-Modified header on all UNIX platforms. If this is a concern, leave this option disabled.
    VersionSort The VersionSort keyword causes files containing version numbers to sort in a natural way. Strings are sorted as usual, except that substrings of digits in the name and description are compared according to their numeric value. For example:
    • ibm-1.7
    • ibm-1.7.2
    • ibm-1.7.12
    • ibm-1.8.2
    • ibm-1.8.2a
    • ibm-1.12
    If the number starts with a zero, then it is considered to be a fraction:
    • ibm-1.001
    • ibm-1.002
    • ibm-1.030
    • ibm-1.04

Notes on IndexOptions directives:

Whenever a '+' or '-' prefixed keyword is encountered, it is applied to the current IndexOptions settings (which may have been inherited from an upper-level directory). However, whenever an non-prefixed keyword is processed, it clears all inherited options and any incremental settings encountered so far. Consider the following example:

IndexOptions +ScanHTMLTitles -IconsAreLinks FancyIndexing 
IndexOptions +SuppressSize

The net effect is equivalent to IndexOptions FancyIndexing +SuppressSize, because the non-prefixed FancyIndexing discarded the incremental keywords before it, but allowed them to start accumulating again afterward. To unconditionally set the IndexOptions for a particular directory, clearing the inherited settings, specify keywords without either '+' or '-' prefixes.

Note: This directive is not supported in <Location> containers.

IndexOrderDefault

Module: mod_autoindex
Syntax: IndexOrderDefault [ ascending | descending ] [ name | date | size | owner | description ] [ CaseSense | NoCaseSense ]
Default: IndexOrderDefault Ascending Name CaseSense
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Modified
Example: IndexOrderDefault descending size

The IndexOrderDefault directive is used in combination with the FancyIndexing index option. By default, FancyIndexed directory listings are displayed in ascending order by filename; the IndexOrderDefault allows you to change this initial display order.

IndexOrderDefault takes two required arguments and a third optional argument.

Parameter One: ascending | descending
  • The ascending and descending parameter indicates the direction of the sort.
Parameter Two: name | date | size | owner | description
  • The name, date, size, owner, and description parameter arguments must be used and identifies the primary key. The secondary key is always ascending filename.
Parameter Three: CaseSense | NoCaseSense
  • The CaseSense and NoCaseSense parameters are optional third keywords that allow you to choose if the column sort is case sensitive. This keyword is valid if the second keyword is name, owner or description only. If the second keyword is date or size, then this parameter is ignored. The default for keyword is CaseSense.

You can force a directory listing to only be displayed in a particular order by combining this directive with the SuppressColumnSorting index option; this will prevent the client from requesting the directory listing in a different order.

Note: This directive is not supported <Location> containers. The directive may be inherited in a <Directory> context, but not in a <VirtualHost> context.

ReadmeName

Module: mod_autoindex
Syntax: ReadmeName filename
Default: none
Context: server config, virtual host, directory (but not location), .htaccess
Override: Indexes
Origin: Apache
Example: ReadMeName readme
Example: ReadMeName README.MBR

The ReadmeName directive sets the name of the file that will be appended to the end of the index listing.

Parameter: filename
  • The filename parameter is the name of the file to include and is taken to be relative to the location being indexed. Details of how its handled may be found under the description of the HeaderName directive, which uses the same mechanism as ReadmeName.
Note: This directive is not supported in <Location> containers.