i wanted to display the module,controller,method being called
i thought that the cms module found in the
app\code\core\Mage\cms\
calls the IndexController.php and uses the IndexAction method .since it is the default page url.
but when I tried to echo out something inside the IndexAction method .nothing comes out. I even tried to call it manually and it still redirects to the home page.
localhost/magento/index.php/cms/index/index/
am i doing it right? how can i display the request url being called in magento?
If you need to get current URL in Magento 2 PHTML file the easiest way to do this is to use the following code: $currentUrl = $block->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]); This is the best method since you don't even need to use the Object Manager.
Base URL — http://www.yourdomain.com/magento/ Secure Base URL — https://www.yourdomain.com/magento/
In above execute() function, When you need redirect to specific URL, You need to pass your custom URL instead of customer/account/login as the second parameter in redirect() function.
I was looking for this also, here's how to do it:
echo Mage::helper('core/url')->getCurrentUrl();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With