STEP-2 - Create Magento 2 Frontend Route and Basic Controller

  1. At [MODULE]/etc folder create frontend folder and routes.xml file in it

<?xml version="1.0" ?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
   <router id="standard">
       <route id="scandipwa"  frontName="scandipwa" >
           <module name="ScandiPWA_Version"/>

2. At [MODULE] create /Controller/Version folders and Index.php in the Version folder


namespace ScandiPWA\Version\Controller\Version;

use Magento\Framework\App\Action\Action;

class Index extends Action
    * @return void
   public function execute()
       echo('Version 5.0.6');

4. Run and set:up and c:f, switch to Luma theme, if you will navigate to http://localhost/scandipwa/version you should see the output, however, if you will switch back to ScandiPWA theme you going to see 404 Page.

Useful Materials Magento 2 Creating a New Page

Last updated