I am trying to set up a .htaccess file with the following content with Apache 2.2.31:
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
This is working fine but not for PHP files. The Header is sent twice. I created an empty HTML file and an empty PHP file. For the HTML file the header is sent correctly but when I request the PHP file the header appears twice in the response.
If I drop the always
keyword the header is sent once but not at all if an errors occurs.
There are no other rewrites/redirects defined. Unfortunately I do not have access to the Apache core configuration but maybe someone got the same problem so I can contact my provider.
OK, I changed the hoster. Now everything works well. I do not know what the problem was exactly. But my hoster did not care about that and I decided to switch to another one.