Peter
Peter

Reputation: 1296

htaccess directive for subfolders

I have (.htaccess in a root directory) fancy directory listing like:

IndexOrderDefault Descending Date

So all subfolders are listed properly (date descending), but I only want the root to list folders alphabetically (sort by name ascending) and leave subfolders as is, creating htaccess for each subfolder isn't an option, so it has to be done within root's htaccess file.

Upvotes: 1

Views: 1284

Answers (1)

Jon Lin
Jon Lin

Reputation: 143856

You'll have to set those in your vhost/server config inside a <Directory> and <DirectoryMatch>, maybe something like this:

<Directory "/path/to/date-order/dir">
    IndexOrderDefault Descending Date
</Directory>

<DirectoryMatch "^/path/to/date-order/dir/[^/]+/">
    IndexOrderDefault Ascending Name
</DirectoryMatch>

The IndexOrderDefault Ascending Name is default ordering.

Upvotes: 3

Related Questions