Back to SiteRouter class

Method buildRewrite

public void
buildRewrite
(mixed &$router, mixed &$uri)
Create a uri based on a full or partial URL string
Parameters
  • \Joomla\CMS\Router\SiteRouter & $router Router object
  • \Joomla\CMS\Uri\Uri & $uri URI object to process
Returns
  • void
Since
  • 4.0.0
Class: SiteRouter
Project: Joomla

Method buildRewrite - Source code

/**
 * Create a uri based on a full or partial URL string
 *
 * @param   SiteRouter  &$router  Router object
 * @param   Uri         &$uri     URI object to process
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function buildRewrite(&$router, &$uri)
{
    // Get the path data
    $route = $uri->getPath();
    // Transform the route
    if ($route === 'index.php') {
        $route = '';
    } else {
        $route = str_replace('index.php/', '', $route);
    }
    $uri->setPath($route);
}