Translations:J3.x:Supporting SEF URLs in your component/79/en
From Joomla! Documentation
The Joomla System SEF plugin will try it's best to handle any URLs that aren't being passed into \Joomla\CMS\Router\Route::_ in your application code. It hooks in on the onAfterRender system plugin event. In this function the body of the response that will be sent to the browser is retrieved using \Joomla\CMS\Application\CMSApplication::getBody. The body of the response is then searched for links containing "/index.php..." and replaces them with a correct SEF url by calling \Joomla\CMS\Router\Route::_(url). Note that this is not the most reliable approach. You should use \Joomla\CMS\Router\Route::_!