If you want to get the current url of the page in Magento, there are alot 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