1

I defined a backend route (etc/adminhtml/routes.xml)

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etcroutes.xsd">
    <router id="admin">
        <route id="test_backend" frontName="test">
            <module name="{Company}_{Module}" />
        </route>
    </router>
</config>

And 2 controller files,

{Company}/{Module}/Controller/Adminhtml/AbstractTestController

abstract class AbstractTestController extends Magento\Backend\App\Action
{
protected $_publicActions = ['index'];

protected function _isAllowed()
{
    return true;
}

{Company}/{Module}/Controller/Adminhtml/Test/Index

class Index extends AbstractTestController
{
    public function execute()
    {
        print_r("test");exit();
    }
}

But when I access http://magento_base_url/admin/test/index I'm redirected to http://magento_base_url/admin/admin/index. Once logged, url works.

Does anybody know how make this url public? (no admin session required)

  • Define it as a frontend route not a backend route. The admin is protected for obvious reasons. – Smartie Mar 22 '16 at 12:46
  • Then, Is possible to use admin controller in a defined frontend route? – smartin Mar 23 '16 at 12:11

Your Answer

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

Browse other questions tagged or ask your own question.