如何按最后修改的顺序sortingapache目录列表

# SET DISPLAY ORDER IndexOrderDefault Descending Name 

上面的值是用来sorting目录列表​​在降低名称值如何创build类似的结果sorting目录在最后修改order.i使用.htaccess.please不显示替代方法

 # SET DISPLAY ORDER IndexOrderDefault last modified 

指定默认的目录显示顺序:

这是我的.htaccess文件的样子

 RewriteEngine On RewriteBase / # Disable server signature ServerSignature Off 

首先:我的pet peeve,从手册中引用.htaccess文件:

如果您有权访问httpd主服务器configuration文件,则应该完全避免使用.htaccess文件。 使用.htaccess文件会降低您的Apache HTTP服务器速度。 您可以包含在.htaccess文件中的任何指令在目录块中设置得更好,因为它具有相同的效果,性能更好。

其次, 更多的手册阅读也是有用的:

IndexOrderDefault指令与FancyIndexing索引选项结合使用。

翻译:在IndexOptions指令中包含IndexOptions选项。
然后在手册的下面:

IndexOrderDefault有两个参数 。 第一个必须是升序或降序 ,指示sorting的方向。 第二个参数必须是关键字Name, Date ,Size或Description中的一个…

结果如下:

 <Directory /some/path> # Disable .htaccess files for performance: AllowOverride none # Enable automatic index generation for directories without a DirectoryIndex file # and sort them by date: Options +Indexes IndexOptions FancyIndexing IndexOrderDefault Descending Date </Directory>