Get Joomla non-sef URL
<?php
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);
?>