Joomla SEO SettingsTask:
Get original Joomla URL from a SEF one. I.e. I want to know which is the real joomla URL, while the SEF one is

http://thietkewebtre.com/index.php/weblinks-component

This may be needed while developing or making modifications in Joomla extension to use the real internal joomla link.

joomla-cms-a-sef-url

Solution:

// Here I "unparse" the Joomla SEF url to get the internal joomla URL
JURI::current();// It's very strange, but without this line at least Joomla 3 fails to fulfill the task
$router =& JSite::getRouter();// get router
$query = $router->parse(JURI::getInstance()); // Get the real joomla query as an array - parse current joomla link
$url = 'index.php?'.JURI::getInstance()->buildQuery($query);

Result in $url: index.php?Itemid=229&option=com_contact&view=contact&id=1