Здравствуйте, я ожидаю: news/view/sport/22
А вижу: http://localhost/test2.2/index.php/news/view/sport/22
Код:
$uri = "http://localhost/test2.2/index.php/news/sport/22";
$uriPattern = "/news\/([\w]+)\/([\d]+)/";
$path = 'news/view/$1/$2';
echo preg_replace($uriPattern, $path, $uri) . '<br>';