1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Include a file globally using the Auto Prepend File field
This guide explains how to specify a file that will be loaded before the desired page, including as if it had been called with the 'require()' function.
For example, to modify the headers of a site, you must make a headers.php (or other) file that contains PHP header() functions and prepended to the beginning of each PHP file:
- via .user.ini file (specific to a folder)
- or via the site configuration on the Manager (global)
How to include a file globally
- open the Manager (manager.infomaniak.com)
- go to Web hosting
- click on the hosting/domain name concerned
- under Sites at the bottom, click on the domain name of the site concerned
- click on the Advanced settings button
- in the Apache tab, enter the path of the file to be included
- save
The headers defined in a .htaccess file are only valid for non-PHP (therefore static) content.
We use php-fpm, which receives the different headers via apache fast_cgi. In the RFC for cgi_www, the "Strict-Transport-Security" header is not among the headers passed via CGI, as confirmed by the Apache document httpd.apache.org/docs/2.2/howto/cgi.html). Also readhttps://www.ietf.org/rfc/rfc3875