Gzip Javascript and CSS afeecting Adsense clicks?

Discussion in 'AdSense' started by 993ti, May 6, 2008.

  1. #1
    Currently i'm trying this code to speed things up a little:
    In my .htaccess:
    # gzip css, javascript, html file
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(.*)(js|css)$ redir.php?file=$1$2&type=$2 [L]
    </IfModule>
    
    FileETag None
    
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/png A2592000
    ExpiresByType application/x-shockwave-flash A2592000
    ExpiresByType text/css A2592000
    ExpiresByType application/x-javascript A2592000
    </IfModule>
    Code (markup):
    And the redir.php file:
    <?php # this is the file redir.php, to gzip javascript and css
    # set the request file name
    $file=$_REQUEST['file'];
    
    # Set Expires, cache the file on the browse
    # Delete it if you don't want it
    header("Expires:".gmdate("D, d M Y H:i:s", time()+15360000)."GMT");
    header("Cache-Control: max-age=315360000");
    
    # set the last modified time
    $mtime = filemtime($file);
    $gmt_mtime = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
    header("Last-Modified:" . $gmt_mtime);
    
    # output a mediatype header
    switch ($_REQUEST['type']){
      case 'css':
        header("Content-type: text/css");
        break;
      case 'js' :
        header("Content-type: text/javascript");
    }
    
    # GZIP the content
    if(extension_loaded('zlib')){ob_start();ob_start('ob_gzhandler');}
    
    # echo the file's contents
    echo implode('', file($file));
    
    if(extension_loaded('zlib')){
      ob_end_flush();
      # set header the content's length;
      # header("Content-Length: ".ob_get_length()); # (It doesn't work? )
      ob_end_flush();
    }
    ?>
    Code (markup):
    I kinda got worried since i saw a small gain in clicks after i installed this and thought that it might be 'clicking' the ads on every pageview.
    Maybe an expert can shed some light on this?
    Thanks in advance.
     
    993ti, May 6, 2008 IP