I want to get the current url of an admin panel page. I tried the folowing.

$currentUrl = Mage::helper('adminhtml')->getUrl();

But it's not returning the current url.

3 Answers 3


Try this :

<?php echo $magentoCurrentUrl = Mage::helper('core/url')->getCurrentUrl();?>

When we see url in magento admin we can see it is formed with secret keys and cannot be accessed without that, below is the simple way to get any url for admin with keys.

echo Mage::helper("adminhtml")->getUrl("module_name/controller_name/action_name/",array("param1"=>1,"param2"=>2));

but to get current url use

echo $magentoCurrentUrl = Mage::helper('core/url')->getCurrentUrl();  

you can get using following code.

if (!in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), array('cms_index_noRoute', 'cms_index_defaultNoRoute'))) {
    $currentUrl = Mage::helper('core/url')->getCurrentUrl();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.