$internal_url = 'index.php?option=com_content&view=article&id=10'; $sef_url = JRoute::_($internal_url); echo $sef_url; // Output: /articles/10-article-name
$internal_url = 'index.php?option=com_content&view=article&id=10'; $sef_url = JRoute::_($internal_url); JFactory::getApplication()->redirect($sef_url);In this example, we’re using JRoute to generate a SEF URL and then redirecting the user to that URL. This can be useful if you want to force users to use SEF URLs instead of the internal Joomla URLs. Package library: Joomla\CMS\Router\Route.