HTTP Strict Transport Security (HSTS) Policy Not Enabled

Hi, I did penetration test and I got this error:

HTTP Strict Transport Security (HSTS) Policy Not Enabled

is there any simple way to add following line to .htaccess by PHPMaker (not manually that will be overwrite on each generate)

<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>

of add the following to PHP header in all pages:

<?php
header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");
?>

You may make an extension to append code to the .htaccess file.