[Resolved] Header set Content-Type Not working

Status
Not open for further replies.

raymond

Active Member
#1
The below htaccess runs the GoogleFontsCSS file as PHP and parse as CSS in browser does not work.
https://github.com/DaAwesomeP/php-offline-fonts/blob/master/fonts/.htaccess

Checking the headers with Firebug shows that the GoogleFontsCSS file content type is "text/html; charset=UTF-8" while it should be text/css instead.

It seems that once I've used the SetHandler to force the file to run as PHP, the content type is hard coded to text/html and does not respect the next "header set content-type" line.

Can you replicate this issue and hopefully provide a fix?

Thanks.
 

NiteWave

Administrator
#2
I did a test, it can be overwritten by php script.

#cat GoogleFontsCSS
Code:
<?php
header("Content-Type: text/css");
echo "this is .css file";
?>
#cat .htaccess
Code:
<FilesMatch "GoogleFontsCSS">
SetHandler application/x-httpd-php
</FilesMatch>
when access domain.com/GoogleFontsCSS
it shows correct response header:
Code:
Content-Type:"text/css"
 
Status
Not open for further replies.
Top