1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
function rewriteURL($url) {
$url=delaccent($url);
$extension=".html";
$separateur="-";
switch(TRUE) {
case (preg_match_all("#^index\.php\?lg=(\w{2})$#Usi", $url, $matche, PREG_PATTERN_ORDER)) :
$format="%s";
$urlrewrite = sprintf($format, $matche[1][0]).$extension;
break;
case (preg_match_all("#^index\.php\?lg=(\w{2})&rub=([\w-]*)$#Usi", $url, $matche, PREG_PATTERN_ORDER)) :
$format="%s/test-%s";
$urlrewrite = sprintf($format, $matche[1][0], $matche[2][0]).$extension;
break;
case (preg_match_all("#^index\.php\?lg=(\w{2})&rub=([\w-]*)&srub=([\w-]*)$#Usi", $url, $matche, PREG_PATTERN_ORDER)) :
$format="%s/rub-%s/srub-%s";
$urlrewrite = sprintf($format, $matche[1][0], $matche[2][0], $matche[3][0]).$extension;
break;
default:
$urlrewrite = $url;
}
return $urlrewrite;
} |
Partager