Problems with Magento Admin 404 Pages

Lately, I have been having a problem with Magento (version 1.5.0.1) and how it is handling 404 errors in the admin. Basically, any time I go to a non-existent admin URL, I am getting redirected to the frontend 404 page. What should actually be happening is that I am redirected to an admin 404 page.

As it turns out, the problem lies with the Phoenix_Moneybookers extensions. In this modules config.xml file, it adds the following admin router:

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <moneybookers before="Mage_Adminhtml">Phoenix_Moneybookers</moneybookers>         
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

On line 99, the Phoenix_Moneybookers controllers are being loaded after the Mage_Adminhtml controllers. What this means is that when Magento is parsing the routes in preparation to dispatch the appropriate controller method, if it comes across an unknown admin URL, then it will fallback to Phoenix_Moneybookers_IndexController->norouteAction() instead of Mage_Adminhtml_IndexController->norouteAction().

The problem can be fixed by changing line 99 in the Moneybookers config.xml to load the controllers before the Mage_Adminhtml modules (although this hasn’t been tested), or by disabling Phoenix_Moneybookers altogether. Like I said, I haven’t tested modifying the config.xml, so if anybody who runs Moneybookers has the time to test, let me know if the module still works with it.

Further Reading

Magento 1.4 Development Cookbook