How to control mod_autoindex header to insert <meta> tags?

463 Views Asked by At

My web server used mod_autoindex to give access to a directory of downloadable files.

How can I make the generated html include my own tags in the header section?

P.S. What I really want is to insert a viewport <meta> tag to help prevent Google flagging the website as "not mobile friendly"

1

There are 1 best solutions below

1
On

The trick is to use the IndexHeadInsert directive in your mod_autoindex config. For me, using Arch Linux, that's in /etc/httpd/conf/extra/httpd-autoindex.conf but it may be different on your distro.

IndexOptions FancyIndexing HTMLTable VersionSort
IndexHeadInsert "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"