Reduce CPU Charge On Server With Rewrite »  Show posts from    to     

Icy Phoenix


Old Docs - Reduce CPU Charge On Server With Rewrite



casimedicos [ Sun 24 Sep, 2006 20:50 ]
Post subject: Reduce CPU Charge On Server With Rewrite
the rewrite spents a lot of cpu usage with this steps

you can do the rewrite only for bots

Code: [Hide] [Select]
#
#-----[ OPEN ]------------------------------------------
#

includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#

function rewrite_urls($content)
{
global $config_mg;

function if_query($amp)

#
#-----[ REPLACE, WITH ]------------------------------------------
#
function rewrite_urls($content)
{
global $config_mg;
if((eregi("bot", getenv("HTTP_USER_AGENT"))) or (ereg("Google", getenv("HTTP_USER_AGENT"))) or (ereg("Slurp", getenv("HTTP_USER_AGENT"))) or (ereg("Scooter", getenv("HTTP_USER_AGENT"))) or (eregi("Spider", getenv("HTTP_USER_AGENT"))) or (eregi("Infoseek", getenv("HTTP_USER_AGENT"))))
{

//
// Begin keyword urls mod
//

function if_query($amp)


#
#-----[ FIND ]------------------------------------------
#

if ( isset($config_mg['url_rw']) && ($config_mg['url_rw'] === '1') )
{
$content = preg_replace($url_in, $url_out, $content);
}

return $content;

#
#-----[ REPLACE, WITH ]------------------------------------------
#
if ( isset($config_mg['url_rw']) && ($config_mg['url_rw'] === '1') )
{
$content = preg_replace($url_in, $url_out, $content);
}
}
return $content;



#
#-----[ OPEN ]------------------------------------------
#

includes/page_tail.php

#
#-----[ FIND ]------------------------------------------
#
// begin keyword urls mod
//

if( function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
$gzip_contents = rewrite_urls(ob_get_contents());
ob_end_clean();
ob_start('ob_gzhandler');
echo $gzip_contents;
ob_end_flush();
}
else
{
$contents = rewrite_urls(ob_get_contents());
ob_end_clean();
echo $contents;
global $dbg_starttime;
}

//
// end keyword urls mod
//
#
#-----[ REPLACE, WITH ]------------------------------------------
#
if((eregi("bot", getenv("HTTP_USER_AGENT"))) or (ereg("Google", getenv("HTTP_USER_AGENT"))) or (ereg("Slurp", getenv("HTTP_USER_AGENT"))) or (ereg("Scooter", getenv("HTTP_USER_AGENT"))) or (eregi("Spider", getenv("HTTP_USER_AGENT"))) or (eregi("Infoseek", getenv("HTTP_USER_AGENT"))))
{
// begin keyword urls mod
//

if( function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
$gzip_contents = rewrite_urls(ob_get_contents());
ob_end_clean();
ob_start('ob_gzhandler');
echo $gzip_contents;
ob_end_flush();
}
else
{
$contents = rewrite_urls(ob_get_contents());
ob_end_clean();
echo $contents;
global $dbg_starttime;
}

//
// end keyword urls mod
//
}


Xusqui [ Mon 25 Sep, 2006 07:37 ]
Post subject: Respuesta: reduce cpu charge on server with rewrite
GREAT!!!!!

he, he!!! You're the #1!!!

Thanks!!


casimedicos [ Mon 25 Sep, 2006 13:36 ]
Post subject: Re: reduce cpu charge on server with rewrite
another optimizations

gzip DISABLED----------------- this reduce cpu usage, and do all faster
and cache blocks


Mighty Gorgon [ Sun 01 Oct, 2006 13:52 ]
Post subject: Re: Reduce CPU Charge On Server With Rewrite
He he he... great suggestion.


jz [ Sun 17 Dec, 2006 19:59 ]
Post subject: Re: Reduce CPU Charge On Server With Rewrite
It does make a difference

nice onecasimedicos,


kappaponza [ Mon 18 Dec, 2006 12:16 ]
Post subject: Re: Reduce Cpu Charge On Server With Rewrite
casimedicos wrote: [View Post]
another optimizations

gzip DISABLED


where is?


jz [ Mon 18 Dec, 2006 19:48 ]
Post subject: Re: Reduce CPU Charge On Server With Rewrite
ACP -> Board Settings




Powered by Icy Phoenix