Magento - Custom admin router but with no menu item

Magento - Custom admin router but with no menu item

October 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Custom admin router but with no menu item

Customizing Magento Admin Routes Without Menu Items

As an experienced Magento developer, you might find yourself desiring more direct control over your admin routes without the associated menu items. This can be particularly useful for creating internal tools or APIs that should not appear in the navigation panel.

The Current Approach and Limitations

Let’s first examine the approach you’ve outlined:

<admin>
    <routers>
        <my_module>
            <use>admin</use>
            <args>
                <module>Me_Mymodule</module>
                <frontName>my_controller</frontName>
            </args>
        </my_module>

         <adminhtml>
            <args>
                <modules>
                    <my_module after="Mage_Adminhtml">Me_Mymodule</my_module>
                </modules>
            </args>
         </adminhtml>
    </routers>
</admin>

This configuration does a few key things:

  • It creates a new router named my_module that uses the admin controller.
  • It sets your module as Me_Mymodule and the front name as my_controller.

However, there are two critical issues with this approach:

  1. Incorrect Module Name: You’ve used Me_Mymodule, but it should match your actual module’s namespace exactly. If your module is located at app/code/local/YourCompany/MyModule/etc/config.xml, then the module name should be YourCompany_MyModule.

  2. Missing Controller Reference: While you’ve correctly set up the router and defined the module, Magento needs a clear reference to where it can find your controller.

Creating a Custom Admin Route

To create a custom admin route without a menu item, follow these steps:

  1. Correct the Module Name

Ensure that your configuration matches your actual module’s namespace exactly. For example, if your module is located at app/code/local/YourCompany/MyModule/etc/config.xml, update your config like so:

<yourcompany_my_module>
    <routers>
        <my_controller>
            <use>admin</use>
            <args>
                <module>YourCompany_MyModule</module>
                <frontName>my_controller</frontName>
            </args>
        </my_controller>
     </routers>
</yourcompany_my_module>
  1. Map Your Controller

To map your controller, you need to specify the directory and file name in your module’s config.xml. For example:

<global>
    <controllers>
        <adminhtml>
            <args>
                <modules>
                    <YourCompany_MyModule before="Mage_Adminhtml">
                        YourCompany_MyModule
                    </YourCompany_MyModule>
                </modules>
            </args>
        </adminhtml>
    </controllers>

    <!-- Other configuration here -->
</global>
  1. Create the Controller

Finally, create your controller at app/code/local/YourCompany/MyModule/controllers/Adminhtml/MyController.php:

class YourCompany_MyModule_Adminhtml_MyController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        // Your custom logic here
    }
}

Conclusion

Creating a custom admin route without an associated menu item involves a few critical steps: correctly naming your module, mapping the controller in the configuration file, and creating the actual controller. By following this guide, you should be able to achieve direct access to your controller via /index.php/admin/my_controller/.

Remember, it’s essential to keep your Magento modules well-organized and clearly named for efficient development and maintenance.

For further reading on Magento module development best practices, check out our comprehensive guide at Laravel Company.

API Extensions Admin Configuration

Our network