Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Content-type: text/css & ob_gzhandler WordPress

[[LINK href="http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css"]]http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css[[/LINK]]

Hello guys. I need a help about php content-type & ob_gzhandler.

I am working on a wordpress framework and I have a document as a css (it is a php document and I get some informations from get_option areas) so, everything is looking ok but actually is not. This is result [[LINK href="http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css"]]http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css[[/LINK]]

I am using these codes on header;
if (function_exists("ob_gzhandler") && !ini_get("zlib.output_compression")) ob_start("ob_gzhandler"); else ob_start();
header("Content-type: text/css");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
header($ExpStr);


but as you check here [[LINK href="http://www.gidnetwork.com/tools/gzip-test.php"]]http://www.gidnetwork.com/tools/gzip-test.php[[/LINK]] > [[LINK href="http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css"]]http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css[[/LINK]]

content type is text/html; charset=UTF-8

I don't know why it is. For that reason css document is not working. The problem is so simple but I cannot see. It is weard.

----

If you check this url sourcecode (http://client.dnomia.com/wp-content/themes/DnomiaFramework/inc/customization.css) you can see this html tags html, head, body etc. for that reason it is not working as a css document.

Answers (1)

2011-09-12

Abdessamad Idrissi answers:

To set encoding for a utf CSS documents use ; @charset "utf-8";

Check how do you call customization.css? is it by include()/require() function or by <link rel="stylesheet" type="text/css" ..

Your question is not so clear though :)


Ceyhun Aksan comments:

I think, the problem is about .htaccess but I am not sure. I am using

<FilesMatch "\.css$">
AddHandler application/x-httpd-php .css
php_value default_mimetype "text/css"
</FilesMatch>


but, It is not ok. Because, css document and others are ok. For example, when I don't use this code into htacess, css document as a php document, php codes etc. but, when it, just css codes. Is it clear?