1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Include a file globally with Auto Prepend File
This guide explains how to specify a file that will be loaded before the desired page or at the beginning of each PHP script executed on your server, included as if it had been called with the require() function, but more globally using the PHP directive auto_prepend_file.
Preamble
- For example, to declare the headers of a website, you can create a
headers.phpfile that contains PHPheader()functions and that is prepended at the beginning of each PHP fileβ¦- β¦ via a
.user.inifile (specific to a folder), - β¦ or via the site configuration in the Manager (global) as explained below.
- β¦ via a
- For additional help contact a partner or launch a free tender β also discover the role of the host.
Include a file globally from the Manager
To access the website management:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the product concerned:
- Click on Manage under Advanced settings:

- Click on the PHP / Apache tab.
- Complete the line concerned by entering the path of the file to include.
- Click on the button at the bottom of the page to save:

After defining this directive, all PHP pages on your server will automatically include the specified file before executing their own code.
The headers defined in a .htaccess file are only valid for non-PHP (i.e., static) content.
Infomaniak uses php-fpm which receives the various headers via apache fast_cgi. In the RFC of cgi_www the header Strict-Transport-Security is not part of the headers passed via CGI and the Apache documentation confirms this. See this other RFC.