How to get current url in Magento?

You can retrieve the current URL path by doing the following:

$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
$path = $url->getPath();

Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.