mod_autoindex的Apache HeaderName指令不生效

问题描述 投票:0回答:2

我不能让我的文件列表前面带有一个名为header.html的html文件。下面是我的整个httpd.conf文件。

#basic config
ServerRoot "D:/phpnow/Apache-22"
Listen 8888
ServerAdmin [email protected]
ServerName localhost
DocumentRoot "D:/"
Options Indexes
#dir_module
LoadModule dir_module modules/mod_dir.so
#<IfModule dir_module>
#    DirectoryIndex index.html
#</IfModule>
#alias_module
LoadModule alias_module modules/mod_alias.so

#autoindex_module
#Alias /icons/ "D:/phpnow/Apache-22/icons/"
LoadModule autoindex_module modules/mod_autoindex.so
DefaultIcon /icons/unknown.gif
IndexOptions FancyIndexing  
HeaderName /header.html

header.html位于d:\ header.html

标题的内容是:

test

Web浏览器的输出是:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
 <head>
  <title>Index of /</title>
 </head>
 <body>
<h1>Index of /</h1>
<pre>      <a href="?C=N;O=D">Name</a>                    <a href="?C=M;O=A">Last modified</a>      <a href="?C=S;O=A">Size</a>  <a href="?C=D;O=A">Description</a><hr><img src="/icons/unknown.gif" alt="[DIR]"> <a href="$RECYCLE.BIN/">$RECYCLE.BIN/</a>           09-Jan-2011 17:59    -   

<img src="/icons/unknown.gif" alt="[DIR]"> <a href="test/">test/</a>               26-Dec-2010 21:10    -  
<hr></pre>

</body></html>
apache httpd.conf mod-autoindex
2个回答
1
投票

如果使用的是Apache 2.2,请确保已取消注释该行,以使用httpd.conf中的Fancy目录列表。>

包含conf / extra / httpd-autoindex.conf


0
投票

[HeaderName必须解析为主要内容类型为text/*的文档(例如,text/htmltext/plain等)。在Windows上,您需要在配置中的某个位置放置AddType text/html .html

© www.soinside.com 2019 - 2024. All rights reserved.