I don't really know where is the problem as it seems I have done as it is explained in the official documentation (except I did stripped it down a little);


<?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="custom" frontName="custom">
            <module name="Company_Module" />



namespace Company\Module\Controller\Adminhtml\Index\Index;

use Magento\Backend\App\Action;
use Magento\Framework\Controller\Result\Raw;
use Magento\Framework\Controller\ResultFactory;

class Index extends Action

    public function execute()
        $result = $this->resultFactory->create(ResultFactory::TYPE_RAW);

        $result->setContents('Hello world');

        return $result;

Unfortunately when I visit http://magento.local.com/admin/custom I get 404 page in admin panel (security keys in URLs are turned off)

Am I missing anything?


The namespace is wrong for start, it should be namespace Company\Module\Controller\Adminhtml\Index;

| improve this answer | |
  • You're right! I didn't notice that! – Revenant Oct 22 '17 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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