我正在使用以下.htaccess来修改我的目录列表:
Options +Indexes
IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble
HeaderName header.html
IndexIgnore header.html footer.html favicon.ico .htaccess .ftpquota .DS_Store icons *.log *,v *,t .??* *~ *#
Run Code Online (Sandbox Code Playgroud)
它加载标题html,其中包含:
<html><head><title>My Stuff</title>
<style type="text/css">
body {
background: #eee;
margin: 33px;
color: #333;
}
h1 {
font: 2.0em Georgia, serif;
}
h1 a:hover, h1 a:active {
text-decoration: none;
}
a:link {
text-decoration: none;
color: #555;
}
a:visited {
text-decoration: none;
color: #777;
}
a:hover, a:active {
text-decoration: underline;
color: maroon;
}
pre {
font: 0.9em/1.3em "Courier New", Courier;
margin: 3px 0;
color: #777;
}
pre img {
display: inline;
}
img {
margin: 3px 0;
}
</style>
</head>
<body><h1><a href="/test" title="My Atlassian Stuff">My Stuff</a></h1>
Run Code Online (Sandbox Code Playgroud)
我去文件夹时看起来很棒/test/.但是,当我去/test/test2/它的时候没有拿起之前的htaccess,从而显示出无聊的默认风格.如何使下层子文件夹粘贴/递归?
放置一个/之前header.html告诉Apache每次查看根.
HeaderName /header.html
Run Code Online (Sandbox Code Playgroud)
编辑:如果您的header.html文件在根目录中不存在,请将路径更改为存储文件的位置.
HeaderName /path/to/header.html
Run Code Online (Sandbox Code Playgroud)