PROBLEM:
The developer creates a new module. Although the module is successfully installed and enabled when clicking on the link on the admin menu it goes to the Dashboard.
Here is the structure of the files in app/code/dfprojects:

In System --> User Roles the entries for the menu are activated:
In the admin menu:
The link from “Eigenanlieferung” is DOMAIN/ADMIN_PSEUDO/dfpea/eigenan/index/key/….
When clicking on “Eigenanlieferung”, the Dashboard will appear.
Here is the app/code/dfprojects/module-dfpea/etc/adminhtml/routes.xml:

and the app/code/dfprojects/module-dfpea/Controller/Adminhtml/Eigenan/Index.php
CAUSES:
There are 2 causes that lead to the problem:
– The code of the route file is not correct
– It lacks the menu.xml file in the etc/adminhtml
SOLUTIONS:
There are 3 simple steps to handle this Magento 2 error:
- Step 1: Editing the app/code/dfprojects/module-dfpea/etc/adminhtml/routes.xml file like the following:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="dfpea" frontName="dfpea"> <module name="DfProjects_DfpEa" before="Magento_Backend" /> </route> </router> </config>
- Step 2: Creating the file app/code/dfprojects/module-dfpea/etc/adminhtml/menu.xml as the following:
<?xml version="1.0"?> <!--@copyright Copyright (c) 2016 www.tigren.com--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"> <menu> <add id="DfProjects_DfpEa:: eigenan" title="Eigenanlieferung" module=" DfProjects_DfpEa " sortOrder="20" resource="DfProjects_DfpEa:: eigenan" /> </menu> </config>
- Step 3: Running the following command:
Php bin/magento cache:flush
Then reloading the page.
We have shown you 3 steps to fix the error related to the custom link in the admin menu of Magento CE 2.1.8. If you have any problems when following the instructions, please leave a comment below. See you in the next Magento 2 tutorials.
See More:
[Fix It Series] Magento Error: Missing all sale tables but sale orders are recorded
[Fix It Series] Magento Error: Invalid Form Key. Please refresh the page
[Fix It Series] Total Price In Wishlist Page Is $0.00 In Magento 2
[Fix It Series] Magento Error: Custom Option Type Fields Are Not Displayed
[Fix It Series] Magento Error: Front Controller Reached 100 router Match Iterations
[ratings]