I want to get the preview page url using:


and it get's me something like:


How do I get just : customer/account/?


Well you use PHP native method parse_url() : http://php.net/manual/en/function.parse-url.php


It will give you the following result:

array(3) {
  string(4) "http"
  string(9) "localhost"
  string(28) "/index.php/customer/account/"

If you want to remove the index.php you can then do:


However, if you want to remove index.php for every page (which is I reckon you should do) you should check this post: How to remove index.php from front end URL In magento?

| 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.