Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post 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: [Download] [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
//
}

 




____________
jack of all trades, master of none
http://www.mieloma.com/ - http://www.casimedicos.com/ - http://www.egalego.com/ - http://www.casimedicos.com.es/ - http://www.medicosmir.com/
 
casimedicos - View user's profileSend private messageVisit poster's website 
Back to topPage bottom
Thanks for the useful Topic casimedicos:
ThE KuKa (24 September), JANU1535 (25 September), m740 (25 September), Xusqui (25 September), buldo (26 September), nickjack (18 December), Gianni PB (24 January) 
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Respuesta: reduce cpu charge on server with rewrite 
 
GREAT!!!!!

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

Thanks!!
 




____________
Icy Phoenix Latest 2.0 (working pending)
Style: Aphrodite and MG_Themes
Site: Spanish Stephen King fan forum
Mods: Medal System Mod. BBAntispam 1.2. Several own BBcodes.
 
Xusqui - View user's profileSend private messageVisit poster's website 
Back to topPage bottom
Reply with quote Download Post 
Post Re: reduce cpu charge on server with rewrite 
 
another optimizations

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




____________
jack of all trades, master of none
http://www.mieloma.com/ - http://www.casimedicos.com/ - http://www.egalego.com/ - http://www.casimedicos.com.es/ - http://www.medicosmir.com/
 
casimedicos - View user's profileSend private messageVisit poster's website 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Reduce CPU Charge On Server With Rewrite 
 
He he he... great suggestion.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty Gorgon - View user's profileSend private messageVisit poster's websiteView user's personal gallery 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Reduce CPU Charge On Server With Rewrite 
 
It does make a difference  

nice onecasimedicos,
 



 
jz - View user's profileSend private message 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Reduce Cpu Charge On Server With Rewrite 
 
casimedicos wrote: [View Post]
another optimizations

 gzip DISABLED


where is?
 




____________
www.pazziperponza.it
 
kappaponza - View user's profileSend private message 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Reduce CPU Charge On Server With Rewrite 
 
ACP -> Board Settings
 



 
jz - View user's profileSend private message 
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events