Knowledge base
1000 FAQs, 500 tutorials and instructional 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 function require(), but more globally using the PHP directive auto_prepend_file.
Preamble
- For example, to declare the headers of a website, you can create a file
headers.phpthat 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
Include a file globally from the Manager
To access the website management:
- Click here to access the management of your site on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the site concerned:

- Click on Manage advanced settings:

- Click on the PHP / Apache tab:

- Complete the relevant line by entering the path of the file to include.
- Click on the Save button at the bottom of the page:

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 different 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. Refer to this other RFC.
Link to this FAQ:
Has this FAQ been helpful?