在 WampServer(如 Wamp5 2.0 等版本)中,访问目录时若开启了文件列表功能,可能会发现图标无法正常显示。该问题通常是因为 Apache 默认的自动索引配置文件中,图标路径指向了独立安装的 Apache 目录,而非 WampServer 的实际安装路径。
解决步骤:
-
定位配置文件 打开 WampServer 安装目录下的 Apache 自动索引配置文件,路径通常为:
\wamp\bin\apache\apache[版本号]\conf\extra\httpd-autoindex.conf(示例:\wamp\bin\apache\apache2.2.6\conf\extra\httpd-autoindex.conf) -
修改图标路径 在配置文件中找到
Alias /icons/指令。默认配置通常指向系统盘下的独立 Apache 路径,例如:Alias /icons/ "C:/Program Files/Apache Software Foundation/Apache2.2/icons/"将其修改为当前 WampServer 中
icons文件夹的实际路径。例如:Alias /icons/ "D:/wamp/bin/apache/apache2.2.6/icons/"注意:请根据实际的安装盘符与 Apache 版本号替换路径。在 Apache 配置文件中,路径建议使用正斜杠
/或双反斜杠\\。 -
重启服务 保存配置文件后,通过 WampServer 控制面板重启 Apache 服务。刷新浏览器页面,文件列表图标即可恢复正常显示。

