Jump to content

Archived

This topic is now archived and is closed to further replies.

rvacs

How can I sort my Apache Directory Listing w/no index.html

Recommended Posts

:D

Hello All,

 

Sorry I have almost no knowledge of Apache but had a question. If your url has no index.html in that directory it shows a listing of files in that directory - GREAT - this is what I want.

 

BUT

 

Are there any scripts or values that allows me the ability to sort the file listing? Basically I would like to alphabetize or sort by type.

Any suggestions of what I should look at???

 

Thanks SO MUCH,

Rich

Share this post


Link to post
Share on other sites

u can already sort ....by Name, Last Modified, Size and even Description...with apache ;D

Share this post


Link to post
Share on other sites

From... http://httpd.apache.org/docs/mod/mod_autoindex.html

 

Autoindex Request Query Arguments

The column sorting headers themselves are self-referencing hyperlinks that add the sort query options to reorder the directory listing. The query options are of the form X=Y, where X is one of N (file Name), M (file last Modified date), S (file Size, or D (file Description), and Y is one of A (Ascending) or D (Descending).

 

When options other than the file name are used as the sorting key, the secondary key is always the file name. (When the file name is used to sort by, there is no need of a secondary sort key, since file names are guaranteed to be unique, and so the sort order is unambiguous.)

 

Example:

 

If the URL http://your.server.name/foo/ produces a directory index, then the following URLs will produce different sort orders:

 

http://your.server.name/foo/?M=D sorts the directory by last modified date, descending.

http://your.server.name/foo/?D=A sorts the directory by file description, ascending.

http://your.server.name/foo/?S=A sorts the directory by file size, ascending.

See IndexOrderDefault to set the default directory ordering.

 

Note also that when the directory listing is ordered in one direction (ascending or descending) by a particular column, the link at the top of that column then reverses, to allow sorting in the opposite direction by that same column.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.