Skip to main content
2 of 2
added 5 characters in body

This is the path reference that you are provided in a layout file

<path>earnings/earnings/</path>

This will set your link to this path http://www.website.com/earnings/earnings. When Magento looks for this path, it cannot find a valid controller definition. That is why it throws 404 error. So set your path to

  <path>earnings/</path>
         or
   <path>earnings/index/</path>

will solve your issue. Now the link looks like http://www.website.com/earnings/index/. You have defined your block for this specific URL. Note you have used earning_index_index handle in your layout file. This handle will be processed by Magento only when http://www.website.com/earnings/index/ URL get requested.

Note: In order to work this URL perfectly, you should have an IndexController.php is defined for your module and this file should hold this method.

public function indexAction() {

   $this->loadLayout();
   $this->renderLayout();
}

If this method and this file are not defined for your module, Magento will throw 404 error again.

Rajeev K Tomy
  • 17.3k
  • 6
  • 63
  • 103