How to Get Current URL with and without parameters in Magento.?
To fetch the current URL in Magento then you need to do this with getCurrentUrl() method in Magento. There are many similar instances and conditions that are discussed below to bring the specific results.
Code to Get Current URL in Magento in module
$currentUrl = $this->helper('core/url')->getCurrentUrl();
Use this code to Get Current URL with parameters in Magento
$params = $this->getRequest()->getParams(); //all the parameters $param = $this->getRequest()->getParam('name'); //parameter "name"
Use this code for Magento get current url without parameters
$request = $this->getRequest(); $urlWithoutParameters = $this->getBaseUrl() . $request->getRouteName() .DS. $request->getControllerName() .DS. $request->getActionName();
Magento get current url without parameters Example
http://localhost/review/product/list