Проблем с gzip

sniperbg

Registered
Здравейте, преди време си сложих gzip компресия на сайта, но сега забелязах, че тя създава няколко бели . Забелязах, че гугъл не индексира цялото съдържание на индекса, а само началото . Не мога да разчитам на трафик от live.com, защото явно ботовете му не поддържат гзип . Този туул http://tools.summitmedia.co.uk/spider/ като съм включил компресията ми показва, че нямам description i keywords и не ми индексира цялото съдържание на страницата . Не мога да се откажа от гзипа, защото ми спестява страшно много трафик и ми намалява големината на страницата от 250 кб на 40кб. Може ли да се направи някакво решение и хем да ползвам компреситя, хем да нямам проблеми с цялосното индексиране на сайта ?

Ето ги двата файла . Единия с гзип, другия без .

С гзип:

Код:
<?php
function compress_output($output)
{
$crc = pack('V',crc32($output));
$size = pack('V',strlen($output));
$output = gzcompress($output, 9);

$data = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
$data .= substr($output, 0, strlen($output) - 4);
$data .= $crc;
$data .= $size;

return $data;
}
header("Content-Encoding: gzip");
ob_start("compress_output"); 
error_reporting(E_ERROR);
require_once ("function/site_function.php");
require_once('function/form_process.php');
require_once('function/main_function.php');
require_once("admin/phpmailer/class.phpmailer.php");
require_once("admin/phpmailer/sentmail.php");

include "config.php";
include "dbconnect.php";
session_start();

global $fileurl,$themedir,$instdir,$baseurl,$pluginfol,$themestyle;
global $sitename,$emailhost,$emailuser,$emailpwd,$emailsender,$modrewrite,$golcat;

$baseurl =$cfg['baseurl'];
$instdir = $cfg['instdir'];
$fileurl =$cfg['fileurl'];
if($fileurl=="")
$fileurl =$baseurl;
$emailsender =$cfg['emailsender'];
$emailhost =$cfg['emailhost'];
$emailuser =$cfg['emailuser'];
$emailpwd =$cfg['emailpwd'];
$sitename =$cfg['sitename'];
$absolutepath = $cfg[absolutepath];
$func = mysql_escape_string($_GET[func]);
$pluginpath = $instdir."admin/plugins/";
$current_plugins = opendir($pluginpath);
$plugindir = array();
$pluginfol = array();
$modrewrite = is_modrewrite($instdir);

while (false !== ($path = readdir($current_plugins))) {
       $plugindir[]= $path;
}

if (is_array($plugindir))
{
    $sublinks="";
    foreach ($plugindir as $plugin) {

        if($plugin=="." || $plugin=="..")
        continue;

        if (is_dir($pluginpath."/".$plugin)){
            $path = $instdir."admin/plugins/$plugin";
               $function_file ="{$plugin}_functions.php";
               if(file_exists($path."/".$function_file))
            include_once($path."/".$function_file);
        }
    }
}

/* Get Site config here */
$config = get_site_config();
/* Check member credit and member online status */
$creditleft =check_credit_left();


delete_idle_online_member();
$themestyle =$config['themestyle'];
$themedir = "theme/$themestyle";
/* end of site config */

require_once("$themedir/function.php");

/* version 1.5 added in */ // language file, theme control
global $themconfig,$disppage;

include("$themedir/lang/en_us.php");  //language file
$themconfig = "$themedir/config.php"; // theme control
if(file_exists($themconfig))
{
    include("$themconfig");
    $themconfig=1;
}
else
$themconfig = 0;
/* end of theme config check */

/* retrieve display name from category */
$sqlcat = "select name,display_name from categories";
$query  = mysql_query($sqlcat);
while(list($name,$display_name) = mysql_fetch_array($query))
{
if($display_name<>"")
    $golcat[$name] =$display_name;
else
    $golcat[$name] =$name;
}
/*  end of retrieve display name from category */
if($creditleft<=0 && !is_member() && $creditleft<>"")
{
    $file = "register.php";
    $disppage="dispmain";
    require_once("$themedir/main.php");
}
else// if($func<>"")
{
    ob_start("member_set_content");

    if($func=="logout") //logging out before proceed
    {
        $disppage="dispmain";
        require_once("$themedir/logout.php");
    }
    
    if($func<>"")
    {
        /* add Tab Handler */
        if($func=="games" || $func=="videos"){
            $_SESSION["functype"] = $func;
            $functype = $func;
            $func = "index.php";
        }
        /* enf of Tab module */
        
        $disppage="dispmain";
        
        if(file_exists($themedir."/$func.php"))
        $file = "$func.php";
        else
        $file ="";
    }

    if($_POST[islogin]<>"" && $_SESSION[username]<>"")
    {
        $category="";
        $games="";
        $file="";
        
    }
    //category page config
    $category = mysql_escape_string($_GET[category]);
    //games detail page config
    $games = mysql_escape_string($_GET[games]);
    //preview games page
    $funcpage = mysql_escape_string($_GET[funcpage]);

    ob_end_flush();

    if($funcpage<>"") //preview game page
    {
        $disppage="";

        if(file_exists($themedir."/$funcpage.php"))
        require_once("$themedir/$funcpage.php");
    }
    else if($category=="" && $games=="")
    {
        $disppage="dispmain";
        require_once("$themedir/main.php");
    }
    else if($category<>"")
    {
        $disppage="dispcat";
        require_once("$themedir/category.php");
    }
    else{
        $disppage="dispgame";
        require_once("$themedir/games.php");
    }
}

mysql_close();


?>

БЕЗ

Код:
<?php
ob_start(ob_gzhandler);
error_reporting(E_ERROR);
require_once ("function/site_function.php");
require_once('function/form_process.php');
require_once('function/main_function.php');
require_once("admin/phpmailer/class.phpmailer.php");
require_once("admin/phpmailer/sentmail.php");

include "config.php";
include "dbconnect.php";
session_start();

global $fileurl,$themedir,$instdir,$baseurl,$pluginfol,$themestyle;
global $sitename,$emailhost,$emailuser,$emailpwd,$emailsender,$modrewrite,$golcat;

$baseurl =$cfg['baseurl'];
$instdir = $cfg['instdir'];
$fileurl =$cfg['fileurl'];
if($fileurl=="")
$fileurl =$baseurl;
$emailsender =$cfg['emailsender'];
$emailhost =$cfg['emailhost'];
$emailuser =$cfg['emailuser'];
$emailpwd =$cfg['emailpwd'];
$sitename =$cfg['sitename'];
$absolutepath = $cfg[absolutepath];
$func =$_GET[func];
$pluginpath = $instdir."admin/plugins/";
$current_plugins = opendir($pluginpath);
$plugindir = array();
$pluginfol = array();
$modrewrite = is_modrewrite($instdir);

while (false !== ($path = readdir($current_plugins))) {
       $plugindir[]= $path;
}

if (is_array($plugindir) )
{
      $sublinks="";
      foreach ($plugindir as $plugin) {

          if($plugin=="." || $plugin=="..")
            continue;

            if (is_dir($pluginpath."/".$plugin)){
                $path = $instdir."admin/plugins/$plugin";
                 $function_file ="{$plugin}_functions.php";
                 if(file_exists($path."/".$function_file))
                include_once($path."/".$function_file);
            }
      }
}

/* Get Site config here */
$config = get_site_config();
/* Check member credit and member online status */
$creditleft =check_credit_left();


delete_idle_online_member();
$themestyle =$config['themestyle'];
$themedir = "theme/$themestyle";
/* end of site config */

require_once("$themedir/function.php");

/* version 1.5 added in */ // language file, theme control
global $themconfig,$disppage;
include("$themedir/lang/en_us.php");  //language file
$themconfig = "$themedir/config.php"; // theme control
if(file_exists($themconfig))
{
      include("$themconfig");
      $themconfig=1;
}
else
$themconfig = 0;

/* retrieve display name from category */
$sqlcat = "select name,display_name from categories";
$query  = mysql_query($sqlcat);
while(list($name,$display_name) = mysql_fetch_array($query))
{
if($display_name<>"")
      $golcat[$name] =$display_name;
else
      $golcat[$name] =$name;
}

/*  end of retrieve display name from category */


/* end of theme config check */

if($creditleft<=0 && !is_member() && $creditleft<>"")
{
      $file = "register.php";
      $disppage="dispmain";
      require_once("$themedir/main.php");
}
else// if($func<>"")
{
      ob_start("member_set_content");

      if($func=="logout") //logging out before proceed
      {
          $disppage="dispmain";
            require_once("$themedir/logout.php");
      }
      
      if($func<>"")
      {
          $disppage="dispmain";
            if(file_exists($themedir."/$func.php"))
$file = "$func.php";
else
$file =""; 
      }
      
      
      if($_POST[islogin]<>"" && $_SESSION[username]<>"")
      {
            $category="";
            $games="";
            $file="";
            
      }
      //category page config
      $category =$_GET[category];
      //games detail page config
      $games =$_GET[games];
      //preview games page
      $funcpage =$_GET[funcpage];
      
      ob_end_flush();

      if($funcpage<>"") //preview game page
      {
            $disppage="";

            require_once("$themedir/$funcpage.php");
      }
       else if($category=="" && $games=="")
      {
            $disppage="dispmain";
            require_once("$themedir/main.php");
      }
      else if($category<>"")
      {
            $disppage="dispcat";
            require_once("$themedir/category.php");
      }
      else{
            $disppage="dispgame";
            require_once("$themedir/games.php");
      }
}

mysql_close();

?>
 
давам пример :-)

Код:
if(!bot)
{
gzip funkciq
}

демек ако е бот да не се ползва функцията за gzip, а ако не е да се ползва.
 

Back
Горе