My aim is to generate a few frontend views with an phtml for each view. I developed a module for that.
File: Routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="standard">
<route id="micuenta" frontName="micuenta">
<module name="MyVendor_Intranet"/>
</route>
</router>
</config>
File: Controller/Index/index.php
resultPageFactory = $resultPageFactory; parent::__construct($context); } /** * Mi Cuenta. * * @return \Magento\Framework\View\Result\PageFactory */ public function execute() { $resultPage = $this->resultPageFactory->create(); $resultPage->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0', true); return $resultPage; }} But I get an apache error: [Mon > [Mon Mar 16 17:54:22.638389 2020] [:error] [pid 4074] [client > 46.27.23.194:62372] PHP Fatal error: Uncaught TypeError: Argument 1 passed to MyVendor\\Intranet\\Controller\\Index\\Index::__construct() > must be an instance of Magento\\Framework\\App\\Action\\Context, > instance of Magento\\Framework\\ObjectManager\\ObjectManager given, > called in > /var/vhosts/algsa.es/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php > on line 93 and defined in > /var/vhosts/algsa.es/app/code/Auren/Intranet/Controller/Index/index.php:15\nStack > trace:\n#0 > /var/vhosts/algsa.es/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): > Auren\\Intranet\\Controller\\Index\\Index->__construct(Object(Magento\\Framework\\ObjectManager\\ObjectManager))\n#1 > /var/vhosts/algsa.es/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): > Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Auren\\\\Intranet\\\\...', > Array)\n#2 > /var/vhosts/algsa.es/vendor/magento/framework/ObjectManager/ObjectManager.php(57): > Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Auren\\\\Intranet\\\\...', > Array)\n#3 /var/vhosts/algsa.es/ve in > /var/vhosts/algsa.es/app/code/Auren/Intranet/Controller/Index/index.php > on line 15 My page gets a blank view and apache log registers the error. PD: Very similar approach from https://magento.stackexchange.com/questions/231727/how-call-magento-2-module-by-url-or-add-route-in-module