Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
Apache HTAccess not applying HeaderName and FooterName to Index

I'm currently trying to make an index for folders which will utilize it. The problem I am having is with the HeaderNameand te FooterName. They just don't apply to the index. The header.html file contains the following:

<html>
    <head>
        <title>My Stuff</title>
        <style type="text/css">
        body {
            background: #eee;
            margin: 33px;
            color: #333;
        }
        </style>
    </head>

and the .htaccess file has the following:

# enable indexes
Options +Indexes

# htaccess protection
<Files ~ "^.*\.([Hh][Tt][Aa])">
 order allow,deny
 deny from all
</Files>

# directory customization
<IfModule mod_autoindex.c>
 # index options
 IndexOptions IgnoreCase
 IndexOptions FancyIndexing
 IndexOptions FoldersFirst
 IndexOptions NameWidth=*
 IndexOptions DescriptionWidth=*
 IndexOptions SuppressHTMLPreamble
 
 # display order
 IndexOrderDefault Descending Name
 
 # page customization
 HeaderName header.html
 ReadmeName footer.html
 
 # ignore page customization files and others
 IndexIgnore header.html footer.html favicon.ico .htaccess .ftpquota .DS_Storeicons *.log *,v *,t .??* *~ *# errorlog
</IfModule>

How can I fix this? I just can't manage to get it to work and have cleared my cache (multiple times) and I have also tried it on other browsers. I have been following a tutorial on how to set this up (as I am not familiar with the .htaccess file and related stuff).

The HTML source which I get from the index is the same as the defaults so I am unable to tell if it's doing anything. I can also say that all of the stuff is in the game folder, making it hence more confusing.

I am unsure of what Apache version I am running as of the host/panel I'm using not displaying it. I've had a look around and can't find it. It most likely is the most used one as most stuff I've done on it has worked without error. I get no errors from the .htaccess also.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I just found this while investigating IndexOptions , and decided to test.

And it seems to work for me (Chrome, using a LAMP server at hostpapa.com)

Demo at: http://www.wsurvey.org/stackOverflow/testIndexOptions/

You can view the page source to verify that SuppressHTMLPreamble works

The .htaccess :

# test of indexOptions 
Options +Indexes

<IfModule mod_autoindex.c>
 # index options
 IndexOptions IgnoreCase
 IndexOptions FancyIndexing
  IndexOptions FoldersFirst
 IndexOptions NameWidth=*
 IndexOptions DescriptionWidth=*
  IndexOptions SuppressHTMLPreamble 
 
 # display order
 IndexOrderDefault Descending Name
 
 # page customization
  HeaderName header.html
  ReadmeName  readme.txt
 
 # ignore page customization files and others
 IndexIgnore header.html footer.html favicon.ico .htaccess .ftpquota .DS_Storeicons *.log *,v *,t .??* *~ *# errorlog
</IfModule>

and the header.html is (ugly, but shows that it works)

<html>
    <head>
        <title>This is a   title</title></title>
        <style type="text/css">
        body,.foo {
            background: tan;
            margin: 33px;
            color: blue;
        }
        .foo {
             background:cyan;
        }
        </style>
    </head>
    
    <body>
    <div class="foo" >This is content in header.html !</div>
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda