Tune your site to load faster

Discussion in 'CSS' started by Indian, Apr 22, 2006.

  1. #1
    If you are using CSS and want to make your site faster try adding this code before any code on your index.php page:

    <?php
    ob_start( 'ob_gzhandler' );
    ?>

    You can see the changes using this URL:

    http://www.websiteoptimization.com/services/analyze/

    You can also compress your CSS files using this tool:

    http://www.cssdrive.com/index.php/main/csscompressor/

    Once you have the compressed css file, rename it to css.php and add the following code on top of it:

    <?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);
    ?>

    Once this is done make sure you edit your reference to the css file. In myc ase its changed from

    style type="text/css">@import url("/style/style.css")

    to

    style type="text/css">@import url("style/style.php")

    It helps in a great way to speed up your site.
     
    Indian, Apr 22, 2006 IP
  2. byoung

    byoung Peon

    Messages:
    106
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    thanks for that, will bookmark for future reference.
     
    byoung, Apr 22, 2006 IP
  3. Imran

    Imran Notable Member

    Messages:
    2,340
    Likes Received:
    190
    Best Answers:
    0
    Trophy Points:
    230
    #3
    Thanks I will try it later,...
     
    Imran, Apr 22, 2006 IP
  4. Indian

    Indian Peon

    Messages:
    1,572
    Likes Received:
    105
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ur welcome :p
     
    Indian, Apr 22, 2006 IP