apache - 如何覆盖 /icons 的索引?

发布于 2024-10-07 13:56:13 字数 705 浏览 0 评论 0原文

我没有意识到这一点,这有点有趣;当您在主机根目录中命名一个目录 icons 时,如果您将浏览器指向 host.com/icons,apache 不会从该目录中读取内容,而是会向您显示一个 Public 列表域图标

我在根目录中添加了一个 icons 目录,并在该目录中放置了一个 key.png 文件,但访问该图像会导致 404。我试图查找是否/在何处记录了此内容以及它是如何记录的关闭。我什么也没找到。有人可以提供指点吗?

PS 我使用的是 XAMPP 1.7.3,它基本上是一个 WAMP,并且有 Apache 2.2.14

编辑
显然,许多实时服务器都启用了此功能,并且可以看到很多地方

I wasn't aware of this, and it is kind of funny; when you name a directory icons in the root of your host, then if you point your browser to host.com/icons, apache does not read from that directory and shows you a listing of Public Domain Icons.

I added an icons directory to the root and placed a key.png file in that directory, yet accessing that image results in 404. I tried to find if/where this has been documented and how it could be turned off. I found nothing. Could someone provide a pointer?

P.S. I am using XAMPP 1.7.3 which basically is a WAMP and has Apache 2.2.14

Edit
Aparently lots of live servers have this turned on and index of /icons could be seen lots of places.

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

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

发布评论

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

评论(3

始终不够 2024-10-14 13:56:13

打开此文件:%XAMPP_PATH%\apache\conf\extra\httpd-autoindex.conf

并将:更改

Alias /icons/ "X:/xampp/apache/icons/"
<Directory "X:/xampp/apache/icons/">

为:

Alias /icons/ "./icons/"
<Directory "./icons/">

重新启动 Apache 服务器。

Open this file: %XAMPP_PATH%\apache\conf\extra\httpd-autoindex.conf

and change :

Alias /icons/ "X:/xampp/apache/icons/"
<Directory "X:/xampp/apache/icons/">

to this:

Alias /icons/ "./icons/"
<Directory "./icons/">

Restart your Apache Server.

怪异←思 2024-10-14 13:56:13

我假设您的 httpd.conf 中有一个别名。

我不熟悉 XAMPP 的配置文件或其位置(谷歌建议它可能位于 \xampp\apache\conf\httpd.conf 中),但我建议您寻找如下所示的行:

Alias /icons/ /usr/local/apache/icons/

请参阅 http://httpd.apache.org/docs/current/mod/mod_alias.html了解更多信息。

编辑:
根据 XMAPP site,您需要检查 \xampp\ apache\conf\httpd.confextra 子文件夹。

I'd assume that you have an alias within your httpd.conf.

I'm not familiar with XAMPP's config files or their location (google suggests it's probably in \xampp\apache\conf\httpd.conf) but I'd suggest you're looking for a line like the following:

Alias /icons/ /usr/local/apache/icons/

See http://httpd.apache.org/docs/current/mod/mod_alias.html for more info.

EDIT:
According to XMAPP site, you need to check \xampp\apache\conf\httpd.conf and the extra subfolder.

场罚期间 2024-10-14 13:56:13

我会查看您的 apache 配置文件 (\xampp\apache\conf\httpd.conf) 或 .htaccess 文件,看看是否存在重定向。

编辑:我认为 Grhm 是正确的,因为 Alias 位于您的配置文件中的某处,根据 XAMPP 站点:

Apache 的主要配置文件。它包括子目录“extra”中的其他文件。

查看 \xampp\apache\conf\ 目录中是否有一个名为 extra 的目录,然后浏览其中的文件并查看该别名是否存在。

I would look in either your apache config file (\xampp\apache\conf\httpd.conf) or your .htaccess files and see if there is a redirect going on.

EDIT: I think Grhm is correct in that an Alias is in your config file somewhere, per the XAMPP site:

The main configuration file for Apache. It's including other files from the subdirectory "extra".

See if there is a directory called extra in the \xampp\apache\conf\ directory and then go through the files in there and see if that Alias is present.

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