Is there a way to disable an admin route, well actually any route. The use case is I have an extension that comes with a frontend section and an admin section but I do not want the admin section to be used. I have disabled the admin menu items but I would like to disable the route as well so that if there are any other links or someone has it bookmarked they get a 404 or redirected to the dashboard.
I know I could setup different roles and disable for some roles but I want it to be a complete removal.
Best Answer
I don't think there is a way to do this without removing the
routers
tag from theconfig.xml
or adding some observers on the predispatch event that will redirect you to a 404 page.But I may be wrong. In case I'm wrong here is a place to start.
The
routers
section of theconfig.xml
files is parsed inMage_Core_Controller_Varien_Router_Standard::collectRoutes
.From what I saw in there, there is no check for a
disabled
flag or something like that.There might be a chance if the the module does not use the
admin
path for backend pages.So if the router is not declared like this:
but uses the other way of declaring routers:
You can create a module and just change the
<use>
tag value to something that's notadmin
orstandard
.So your new module that depends on the original one can have the routers section like this:
Why I thing it could work? because in the method mentioned above the only
if
with noelse
that could return false isif ($use == $useRouterName)
.This is just an assumption. I haven't tested it. I don't have any extensions that use this type of routers for backend.