Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda