2
votes

I tried this

Options +Indexes
IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8
HeaderName /header.html
ReadmeName /footer.html
IndexIgnore header.html footer.html .htaccess

How To Include a PHP File Site-wide Using .HTACCESS or other methods

Apply .htaccess HeaderName to all lower levels?

How To Include a PHP File Site-wide Using .HTACCESS or other methods

It just simply does not do anything. I also followed an old guide to enable Layout Header (something with mod_layout in apache) but it seems it's too old.

The best i managed to do is to show the content of my "header.html" into the directory (which is listed with Option +Indexes)

I am doing all of this in a specific folder .htaccess, not in the root .htaccess It looks like this :

Options +Indexes

IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble HeaderName header.html

Please, help

2
What are you trying to do specifically? What type of header of your trying to send? - Panama Jack
simply some html, with a link and a little message - pedrotester

2 Answers

1
votes

I think you're confusing HTTP Headers with a HTML "Header" (meaning the top of the page)

A HTTP header is used to define things like the encoding, content type (eg JSON/XML), not to add HTML to the top of another HTML page.

If you want to add HTML to the top of each page, .htaccess isn't the place to do this - you need to use some kind of scripting/programming language (eg ASP/PHP) to include the files.

Note that none of the three SO questions you link do what you want either:

0
votes

If someone has the same problem, when you write the full path, /www/pages/header.html is not enough, you must write /home/User/www/pages/header.html (if you're on linux or C://etc... on windows)

Why? because it is shown on several folders (recursively), so the path changes depending on the directory you're in