Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to PHP header function

I'm working on a website that has a number of style sheets all of which need to be handled as PHP scripts server-side. My .htaccess file looks something like this:

<FilesMatch "\.(css)$">
    ForceType application/x-httpd-php
</FilesMatch>

This causes a small problem as the mime type of the http-response's Content-Type field is then set to text/html instead of text/css.

Obviously I can fix this by adding header('Content-Type: text/css') to all of my files but is there a better way?

Can I do this from within the .htaccess file? None of the directives offered by mod_mime or mod_negotiation seem to be what I'm looking for.

like image 653
Kevin Loney Avatar asked Jan 24 '23 21:01

Kevin Loney


1 Answers

try:

php_value default_mimetype "text/css"
like image 168
Cal Avatar answered Jan 26 '23 09:01

Cal