I'm beginning with Magento CE 2.1 and I'm stuck with an admin custom route issue that results in a 404 error.
I created a module named 'VM_import' and get it registered (checked).
Now i try to create a custom route :
file : app\code\ [company_name]\VM_import\etc\adminhtml\routes.xml
<?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="example" frontName="example">
<module name="VM_import" before="Magento_Backend" />
</route>
</router>
</config>
and a dedicated Controller :
file : app\code\ [company_name]\VM_import\Controller\Adminhtml\Index\Index.php
<?php
namespace <company_name>\VM_import\Controller\Adminhtml\Index;
class Index extends \Magento\Backend\App\Action
{
public function execute()
{
echo 'it works !';
die();
}
}
Then trying to access to http://[host]/[admin_path]/example results in a 404 error page.
I believe i did something wrong (paths, namespaces, ...) that makes the routing process fail but I cannot figure out what it is or how to efficiently debug it.
Any help would be really appreciated :)