使用用户友好的目录列表替换 Apache 的 mod_autoindex 的简单脚本

发布于 2024-07-12 22:39:12 字数 1047 浏览 7 评论 0原文

Apache 模块 mod_autoindex 生成“目录索引”,向用户显示粗略的索引目录内文件和目录的超链接列表(当没有index.html或其他DirectoryIndex 文件)。

我在 Apache Web 服务器上有一个目录,我想在其中提供自动目录列表,包括完整的文件名,按最近修改的顺序排列,并显示文件大小,使用简单且有吸引力的演示文稿。 我无法使用 mod_autoindex 或其他 Apache 功能。

因此,我正在寻找一个简单的脚本,其功能与 mod_autoindex 大致相同。 换句话说,我想要一个可以放在目录中的脚本,该脚本将 HTML 文档输出到 STDOUT,其中包含目录中文件的超链接列表。

该脚本应以简单的 & 形式呈现其输出。 有吸引力的方式(非技术人员将使用它),由一个我可以根据需要编辑的文件组成,并且最好是独立于操作系统的(这样我以后可以再次使用它)。 额外的功能会很棒,但易于安装是最重要的(尽管如果需要的话我很乐意调整代码)。

我更喜欢 Perl 脚本(即 index.pl 文件),但 PHP 也可以接受(index.php)。 这些是服务器上唯一的 DirectoryIndex 选项。

更新

我决定优先使用snif而不是< a href="http://autoindex.sourceforge.net/" rel="nofollow noreferrer">AutoIndex 来解决当前的问题,但我仍然对找到一个 perl 实现感兴趣,所以如果你知道一个请发布。 谢谢。

The Apache module mod_autoindex generates "directory indexes" that show users a crude hyperlinked list of the files and directories inside a directory (when there is no index.html or other DirectoryIndex file).

I have a directory on an Apache webserver where I want to provide an automatic directory listing, including the full filenames, sorted most-recently-modified-first, with file sizes displayed, using simple and attractive presentation. I cannot use mod_autoindex or other Apache features.

I am therefore looking for a simple script that does much the same thing as mod_autoindex. In other words I want a script I can put in a directory that outputs an HTML document to STDOUT that contains a hyperlinked list of the files in the directory.

The script should present its output in a simple & attractive way (non-technical people will be using it), consist of one file that I can edit if required, and preferably be OS-independent (so I can use it again later). Extra features would be great, but ease of install is all-important (though I am happy to tweak the code if I have to).

My preference is for a perl script (i.e. an index.pl file), but PHP would be acceptable (index.php). Those are the only DirectoryIndex options on the server.

Update

I have decided to use snif in preference to AutoIndex to solve the current problem, but I am still interested in finding a perl implementation, so if you know of one please post it. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风吹雪碎 2024-07-19 22:39:12

snif 很好,我认为可以满足您的所有需求。
链接

snif is nice and I think meets all your needs.
Link

折戟 2024-07-19 22:39:12

我想 AutoIndex 可以解决您的问题。

I guess AutoIndex could solve your problem.

纸短情长 2024-07-19 22:39:12

在您的 httpd.conf 文件中或使用:

use Apache::Icon ();
使用 Apache::AutoIndex;

从 :
cpansearch.perl.org/src/GOZER/Apache-AutoIndex-0.08/AutoIndex.pm

来自:
http://www.google.com/search?num =20&q=perl+Apache%3A%3AAutoIndex

in your httpd.conf file or with:

use Apache::Icon ();
use Apache::AutoIndex;

from :
cpansearch.perl.org/src/GOZER/Apache-AutoIndex-0.08/AutoIndex.pm

from:
http://www.google.com/search?num=20&q=perl+Apache%3A%3AAutoIndex

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文