Make your .CSS file to .PHP file.

You can compress your .css file to .php file by following procedure.

1)      Create a file “stylesheet.php” and add the code to this file.


   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";




/*CSS styles here*/


2)      Now call this file inside to your site head.

<link rel='stylesheet' type='text/css' href='css/stylesheet.php' />




Written by Ranjeet Jha

Ranjeet Jha

Hey there! My name is Ranjeet. I’m a Web Designer & Front-end Developer. I design, code, build & promote all things HTML5, CSS3, JavaScript & jQuery. In this blog you will find solutions of day to day problems faced by you.. Enjoy Coding..

Leave a Reply

Your email address will not be published. Required fields are marked *