1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Auto Prepend File
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)
Globally including a file
- open the Manager (manager.infomaniak.com)
- go to Hosting
- click on the hosting/domain name concerned
- under Sites at the bottom, click on the domain name of the site concerned
- click on Advanced settings
- under the Apache tab, enter the path of the file to include
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 documentation (httpd.apache.org/docs/2.2/howto/cgi.html). Also readhttps://www.ietf.org/rfc/rfc3875