Magento – Get only the page path of the URL

magento2url

I need to get the path of the current page like – /customer/account/ NOT http://magento.dev/customer/account/index/

Any idea how to do it?

Best Answer

Within a block, you should be able to use...

<?php echo $block->getRequest()->getRequestUri() ?>

...to return just the path portion of the full current page URL.

Related Topic