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
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.
For the content type you use AddType from mod_mime. Assuming all your files have .php
extensions:
AddType application/xhtml+xml .php
Caching is set in mod_expires, but you need mod_headers to set Cache-Control:
<FilesMatch "\.php$">
Header set Cache-Control "no-transform"
</FilesMatch>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With