Set HTTP header for all PHP scripts via .htaccess file

.htaccess, directory

Solution

If you want to do this with .htaccess (or in Apache config), you can use Apache module mod_headers, like this:

Header set Cache-Control "no-transform"
Header set Content-Type "application/xhtml+xml; charset=utf-8"

A search on htaccess set header gives you many more examples of this.

Problem

I code same lines all PHP programs at one of my projects. Is it possible to do this at .htaccess for a directory? And how? PHP codes: ``` Header('Content-Type: application/xhtml+xml; charset=utf-8'); Header("Cache-Control: no-transform"); ``` Thanks any help. Best regards. Yusuf Akyol

Original source