Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

magento display request url

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?

like image 678
kapitanluffy Avatar asked Nov 22 '11 23:11

kapitanluffy


People also ask

How to get URL path in Magento 2?

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.

What is base URL in Magento?

Base URL — http://www.yourdomain.com/magento/ Secure Base URL — https://www.yourdomain.com/magento/

How do I redirect observer in Magento 2?

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.


1 Answers

I was looking for this also, here's how to do it:

echo Mage::helper('core/url')->getCurrentUrl();
like image 84
csbartholomew Avatar answered Oct 12 '22 03:10

csbartholomew