I'm building a Magento 2 module, I need to set up a frontpage page and show some information, I have created my routing:

routes.xml (in namespace/modulename/etc/frontend)

<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
  <router id="standard">
    <route id="namespace_modulename" frontName="modulename">
        <module name="Namespace_ModuleName"/>

I have also my Controller:


namespace Namespace\ModuleName\Controller\Index;

use \Magento\Framework\App\Action\Context;

class Index extends \Magento\Framework\App\Action\Action

     * Index constructor.
     * @param Context $context
    public function __construct(
        Context $context
    ) {

     * @return \Magento\Framework\View\Result\PageFactory
    public function execute()
        echo "Test";


When i go to modulename/index/index I'm getting g page not found.

Not sure why, any ideas? Already done magento upgrade and i can see the module there.

My module registration:


2 Answers 2



//Your content ok


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Namespace_Modulename" schema_version="1.0.1" setup_version="1.0.1"/>

Make sure your controller is located inside


and create a module.xml file.

  • Already done, still cant get the hello world from the execute function on my browser, im getting page not found, already done re index also. Oct 23, 2018 at 15:33
  • Did you create module.xml file inside 'namespace/modulename/etc/' ? It should work.
    – Jim
    Oct 23, 2018 at 16:28
  • Yes its working now, changed to lower case the letters. Oct 23, 2018 at 19:01
  • @lucasvm1980, have you fixed this issue ? Oct 24, 2018 at 16:07
  • Yes, using lowecase on module name. Oct 24, 2018 at 17:51

Your Answer

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

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