get Current page url in magento is so easy.You can get lots of solution in differnet site.But this one is the sort and best solution for getting Current page url.
<?php
echo $currUrl= $this->getUrl('').$_SERVER['REQUEST_URI'];
?>
You can also use the folllowing magento features to get current page Url.
$currentUrl = Mage::helper('core/url')->getCurrentUrl() or
$currentUrl = Mage::getUrl('*/*/*', array('_current' => true)); above code may not work always as expected. Better way to find the current url is to use the following code:
thanks it helps :-)
ReplyDelete$currentUrl = Mage::helper('core/url')->getCurrentUrl()
ReplyDeleteor
$currentUrl = Mage::getUrl('*/*/*', array('_current' => true));
above code may not work always as expected.
Better way to find the current url is to use the following code:
if (!in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), array('cms_index_noRoute', 'cms_index_defaultNoRoute'))) {
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
}
Source: http://www.blog.magepsycho.com/how-to-find-current-url-in-magento/