Ciao, ho visto il framework, e proverò a installarlo per vedere se funziona a dovere.
Nel frattemnpo avevo trovato questo su google:
Codice PHP:
<?php
// initialize output buffer to compress page.
// note: I recommend using 'ob_gzhandler' for pages >5kb. Any smaller its not worth it.
ob_start('ob_gzhandler');
// call the rewrite function.
HandleRewrite();
// do your page stuff...
echo '[url="index.php?subpage=MYPAGE"]Hello World![/url]';
// handle the URL rewriting
function HandleRewrite()
{
// rewrite URLS from output buffer
// note: it is IMPERATIVE this function is ABOVE the ob_start('rewrite') callback.
function rewrite($buffer)
{
// this preg_replace changes "mysite.com/index.php?subpage=TEST to mysite.com/TEST
$buffer = preg_replace('/index.php\?subpage=(\w)/is', "$1", $buffer);
return $buffer;
}
// start the output buffer for rewriting ('rewrite' being the callback function)
ob_start('rewrite');
}
?>
Funziona benissimo, l'unico problema è quando si vuole specificare una percorso dentro una cartella, ad esempio cambiandolo queste due righe così:
Codice PHP:
echo '[url="/prova/index.php?subpage=MYPAGE"]Hello World![/url]';
$buffer = preg_replace('/prova/index.php\?subpage=(\w)/is', "$1", $buffer);
//oppure in quest'altro modo:
$prova = "../prova/index.php";
$buffer = preg_replace('/$prova\?subpage=(\w)/is', "$1", $buffer);
Il rewrite non funziona più nella maniera che avevo stabilito.
Cosa sbaglio?