Magento admin controller gives 404

Magento admin controller gives 404

August 23, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento admin controller gives 404

Solving Magento Admin Router 404 Errors

Are you facing a frustrating 404 error when trying to access your custom admin controllers? You’re not alone. In this post, we’ll troubleshoot the issue step-by-step and ensure that your admin router is properly picked up by Magento.

Understanding the Problem

You’ve correctly followed Alan Storm’s guide (link) to set up an admin controller. You have the config.xml file configured with the correct module, version, and router arguments:

<config>
    <modules>
        <Clean_Integration>
            <version>1.0.0</version>
        </Clean_Integration>
    </modules>
    <admin>
        <routers>
            <wellnesscoach_app_redirect>
                <use>admin</use>
                <args>
                    <module>Clean_Integration</module>
                    <frontName>appsync</frontName>
                </args>
            </wellnesscoach_app_redirect>
        </routers>
    </admin>
</config>

And your controller file (IndexController.php) is correctly extending Mage_Adminhtml_Controller_Action. However, when you try to access the URL, it redirects to the frontend and throws a 404 error.

Investigating the Issue

Let’s dive into potential causes for this behavior:

Incorrect Controller Path or Class Name

Ensure that your controller path aligns with Magento conventions. The file should be located at app/code/local/Clean/Integration/controllers/IndexController.php. The class name must match the filename, so it should be Clean_Integration_IndexController.

Missing _redirectUrl Method

Your current code uses $this->redirect('appointments/sync/backend/');, which is not a valid method. It should be $this->_redirect('appointments/sync/backend/');. Note the use of underscores.

Incorrect URL Structure

Remember that admin URLs have a specific format: index.php/admin/<frontend_name>/<controller>/<action>. In your case, it would look like this:

http://your-magento-site.com/index.php/admin/appsync/index/index

Incorrect Routing Configuration

The router name in the config.xml must match an existing router. In your example, wellnesscoach_app_redirect does not seem to be a standard Magento router. Double-check that you’ve named it correctly.

The Solution

To resolve this issue:

  1. Make sure your controller file and class name follow the Magento naming conventions.
  2. Update the redirection method in your indexAction to use $this->_redirect() instead of the incorrect syntax.
  3. Ensure that your URL structure matches the expected format (index.php/admin/<frontend_name>/<controller>/<action>).
  4. Verify that the router name in your config.xml aligns with an existing Magento admin router.

Conclusion

In most cases, 404 errors when accessing custom admin controllers are due to either incorrect configuration or syntax issues. Double-check all components—your config.xml file, controller path and class name, redirection method, URL structure, and router name—and ensure they adhere to Magento’s established conventions.

Remember, the key lies in understanding how Magento routes requests and how your custom configurations fit into this framework. By following these guidelines and keeping a close eye on syntax consistency, you can successfully integrate custom admin controllers without any 404 errors.

If you’re looking for more detailed guides or professional assistance with Magento development, feel free to reach out to our team at https://laravelcompany.com/. We specialize in delivering high-quality, secure, and optimized solutions tailored to your business needs.

Extensions Admin Configuration Errors

Our network