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?


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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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