Adding text to each of the index pages generated by Apache using .htaccess

I want to add some text right below "Index of X" on the index pages in Apache.  I can't change the server config, so I need to do this with a .htaccess file.  Is there a way of doing this?
Who is Participating?
brozzisConnect With a Mentor Commented:


You should be sure that mod_autoindex is loaded in your apache server:

LoadModule autoindex_module modules/

I took this from my vh configuration,
it comes out pretty straightforward which lines use in your .htaccess:

<Directory "/var/www/sites/nexus/autoindex/">
    AllowOverride None
    Options Indexes
    Order allow,deny
    Allow from all
    HeaderName HEADER.html
    ReadmeName FOOTER.html
     IndexOptions IgnoreClient
    IndexOptions HTMLTable
    IndexOptions SuppressColumnsorting

this is obviously just an example,
the directive HeaderName HEADER.html adds to your index file
the content of the HEADER.html file, and if I understood correctly is what you were looking for.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.