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?


1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.