apache 的目錄索引樣式用的mod_autoindex子產品 一般預設為開啟狀态
我們直接配置httpd.conf檔案
講如下内容加到HTTD.CONF
<code>Options Indexes FollowSymLinks</code>
<code>IndexOptions FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble HTMLTable</code>
<code>IndexOptions Charset=GB2312 IconHeight=16 IconWidth=16 SuppressRules</code>
<code>IndexIgnore web header.html footer.html bepc.jpg actions defects</code>
<code>HeaderName </code><code>/web/header</code><code>.html</code>
<code>ReadmeName </code><code>/web/footer</code><code>.html</code>
<code>IndexOrderDefault Ascending Date</code>
<code>ServerSignature Off</code>
Indexes 是開啟目錄浏覽 如果不想開啟 就直接删除這個關鍵字 或者前面加個-
如: -Indexes就是禁止浏覽目錄
IndexOptions FancyIndexing 這個是打開花式索引
FoldersFirst 這個是檔案夾優先
NameWidth和DescriptionWidth是檔案名和描述符的長度
SuppressHTMLPreamble 是去掉APACHE自動生成一些HTML代碼 例如 Index of
HTMLTable 是啟用HTML表格樣式
Charset=GB2312 設定字元集
IconHeight=16 IconWidth=16 圖示的大小
SuppressRules 這個是在FancyIndexing開啟的情況下取消HR标簽
IndexIgnore 這個排除檔案和目錄的 就是那些檔案不顯示出來
<code>HeaderName </code><code>/web/header</code><code>.html 這個是頭檔案</code>
<code> ReadmeName </code><code>/web/footer</code><code>.html 這個結尾的檔案</code>
<code>示例:header.html檔案 主要這兩個HTML檔案要絕對路徑</code>
<code></code>
<code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></code>
<code><</code><code>html</code> <code>xmlns</code><code>=</code><code>"http://www.w3.org/1999/xhtml"</code><code>></code>
<code><</code><code>head</code><code>></code>
<code><</code><code>meta</code> <code>http-equiv</code><code>=</code><code>"Content-Type"</code> <code>content</code><code>=</code><code>"text/html; charset=gb2312"</code> <code>/></code>
<code><</code><code>title</code><code>>鏡像伺服器</</code><code>title</code><code>></code>
<code><</code><code>style</code> <code>type</code><code>=</code><code>"text/css"</code><code>></code>
<code><!--</code>
<code>.STYLE1 {</code>
<code>font-family: "微軟雅黑";</code>
<code>font-weight: bold;</code>
<code>font-size:36px;</code>
<code>color: #0080FF;</code>
<code>}</code>
<code>table {width:100%;border-collapse:collapse;}</code>
<code>table td { line-height:17px; font-size:15px; text-align:left; border:1px #858585 solid;}</code>
<code>table tr:nth-child(odd){ background:#f0f0f0;}</code>
<code>table tr:hover{background:#ACD6FF; color:#990000;}</code>
<code>table th {background:#999999;line-height:17px;}</code>
<code>table th a:link {color:#FFFFFF;}</code>
<code>table th a:visited {color:#FFFFFF;}</code>
<code>table th a:hover {color:#FFFF00;}</code>
<code>--></code>
<code></</code><code>style</code><code>></code>
<code><!--[if lt IE 9]></code>
<code><script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script></code>
<code><![endif]--></code>
<code></</code><code>head</code><code>></code>
<code><</code><code>body</code><code>></code>
<code><</code><code>center</code><code>></code>
<code><</code><code>img</code> <code>src</code><code>=</code><code>"/web/logo.gif"</code> <code>width</code><code>=</code><code>"231"</code> <code>height</code><code>=</code><code>"63"</code> <code>/><</code><code>img</code> <code>src</code><code>=</code><code>"/web/bg.png"</code> <code>width</code><code>=</code><code>"450"</code> <code>height</code><code>=</code><code>"50"</code> <code>/></code>
<code></</code><code>center</code><code>></code>
<code>footer</code><code>.html檔案内容如下:</code>
<code></</code><code>body</code><code>></code>
<code></</code><code>html</code><code>></code>
footer.html可以加入自己的喜歡的内容
加載apache目錄下的extra/httpd-autoindex.conf檔案 可以下載下傳一些自己喜歡的圖示檔案放入
配置完成後 重新開機apache就可以了
本文轉自flyingzf 51CTO部落格,原文連結:http://blog.51cto.com/flyingzf/1335312,如需轉載請自行聯系原作者