apache 的目录索引样式用的mod_autoindex模块 一般默认为开启状态

我们直接配置httpd.conf文件

讲如下内容加到HTTD.CONF


Options Indexes FollowSymLinks
IndexOptions FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble HTMLTable
IndexOptions Charset=GB2312 IconHeight=16 IconWidth=16 Suppre***ules
IndexIgnore web header.html footer.html bepc.jpg actions defects
HeaderName /web/header.html
ReadmeName /web/footer.html
IndexOrderDefault Ascending Date
ServerSignature Off



Indexes 是开启目录浏览  如果不想开启 就直接删除这个关键字 或者前面加个-

如: -Indexes就是禁止浏览目录

IndexOptions FancyIndexing  这个是打开花式索引

FoldersFirst 这个是文件夹优先

NameWidth和DescriptionWidth是文件名和描述符的长度

SuppressHTMLPreamble 是去掉APACHE自动生成一些HTML代码 例如  Index of

HTMLTable 是启用HTML表格样式

Charset=GB2312 设置字符集

IconHeight=16 IconWidth=16 图标的大小

Suppre***ules 这个是在FancyIndexing开启的情况下取消HR标签

IndexIgnore 这个排除文件和目录的 就是那些文件不显示出来

HeaderName /web/header .html  这个是头文件

 ReadmeName /web/footer.html   这个结尾的文件

示例:header.html文件  主要这两个HTML文件要绝对路径


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>镜像服务器</title>
<style type="text/css">
<!--
.STYLE1 {
font-family: "微软雅黑";
font-weight: bold;
font-size:36px;
color: #0080FF;
}
table {width:100%;border-collapse:collapse;}
table td { line-height:17px; font-size:15px; text-align:left; border:1px #858585 solid;}
table tr:nth-child(odd){ background:#f0f0f0;}
table tr:hover{background:#ACD6FF; color:#990000;}
table th {background:#999999;line-height:17px;}
table th  a:link {color:#FFFFFF;}
table th  a:visited {color:#FFFFFF;}
table th  a:hover {color:#FFFF00;}
-->
</style>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
</head>
<body>
<center>
<img src="/web/logo.gif" width="231" height="63" /><img src="/web/bg.png" width="450" height="50" />
</center>


footer.html文件内容如下:

</body>
</html>

footer.html可以加入自己的喜欢的内容
加载apache目录下的extra/httpd-autoindex.conf文件  可以下载一些自己喜欢的图标文件放入

配置完成后 重启apache就可以了