PHP: how to serve right content-type (depending on file extension?)?

Pymnesomo

New Member
I'm using the scripts below to gzip some CSS and JS files. It works nice - except for serving JS files with the wrong content-type (and not the appropriate application/x-javascript). How could I improve the PHP code in order to serve the right content-type? Thanks!.htaccess:\[code\]AddHandler application/x-httpd-php .css .jsphp_value auto_prepend_file gzip.php\[/code\]gzip.php:\[code\]<?php ob_start ("ob_gzhandler");header("Content-type: text/css; charset: UTF-8");header("Cache-Control: must-revalidate");$offset = 60 * 60 ;$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s",time() + $offset) . " GMT";header($ExpStr);?>\[/code\]
 
Back
Top