Get Current Url Of The Page In Magento



If you want to get the current URL of the page in Magento, there are a lot of solutions. I have given below the easiest and tested method here
$currentUrl = $this->helper('core/url')->getCurrentUrl();
echo $currUrl= $this->getUrl('').$_SERVER['REQUEST_URI'];
$urlRequest = Mage::app()->getFrontController()->getRequest();
 $urlPart = $urlRequest->getServer('ORIG_PATH_INFO');
 if(is_null($urlPart))
 {
 $urlPart = $urlRequest->getServer('PATH_INFO');
 }
 $urlPart = substr($urlPart, 1 );
 $currentUrl = $this->getUrl($urlPart);
$baseUrl = Mage::getBaseUrl(); // Gives the base url of your magento installation
$mediaUrl = Mage::getBaseUrl('media'); // Gives the url of media directory inside your magento installation

Hope this will help to someone.