I created a Magento page with an URL Key condicoes-gerais. I'm trying to create an hyperlink to that page in a phtml file. I'm using the following command:

<a href="<?= $this->getUrl('', array('_direct'=>'condicoes-gerais'))?>"> (Ler condições)</a>

When i click the link MAgento redirect page to 404 Not found error. What is the best option to create the hyperlink?

  • can you try <?= $this->getUrl('condicoes-gerais') ?> – Sukumar Gorai Jun 20 '18 at 11:05
  • or Mage::getUrl('condicoes-gerais'); – Konrad Siamro Jun 20 '18 at 11:20
  • Sukumar's sugestion makes my server jump to mydomain.com/condicoes-gerais/ and it gives an error of page not found. Konrad's sugestion, in my phtml it gives an error saying Mage doesn't exist. – Nuno Sousa Jun 20 '18 at 16:45

With <?= $this->getUrl('condicoes-gerais') ?> it works. Thanks.

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