0

Adding menu.xml in a new magento 2.1.3 installation causes redirect loop in the admin

I am creating a new module, but when tried to add menu.xml in etc/adminhtml directory in the module directiory, the browser shows error of redirect loop Magento Version: Magento CE 2.1.3 Mysql Version: 5.6.28 PHP version: 7.0.8

Steps to reproduce issue 1. Install new Magento CE 2.1.3 2. Create new module in app/code with all required files in etc directory of the module 3. Add menu.xml and add items in the menu

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Ktpl_Testimonial::menu" title="IntroBrand" translate="title" module="Ktpl_Testimonial" sortOrder="0" resource="Ktpl_Testimonial::menu"/>
        <add id="Ktpl_Testimonial::testimonial" title="Manage Testimonials" translate="title" module="Ktpl_Testimonial" sortOrder="0" parent="Ktpl_Testimonial::menu" resource="Ktpl_Testimonial::testimonial"/>
    </menu>
</config>

Edit
Added acl.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Ktpl_Testimonial::menu">
                    <resource id="Ktpl_Testimonial::testimonial"/>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

Expected result

It should add a main menu item in the admin menu and a child menu item in the new menu item.

Actual result

It creates a redirect loop when try to log in to the admin

screenshot from 2017-01-19 12 44 34

7
  • have you enable module Ktpl_IntroBrand? – Rakesh Jesadiya Jan 19 '17 at 7:23
  • Might be issue in resource Ktpl_IntroBrand – Rakesh Jesadiya Jan 19 '17 at 7:24
  • Yes, i have enabled the module rakesh. – Taral Patoliya Jan 19 '17 at 7:24
  • I have added the acl.xml – Taral Patoliya Jan 19 '17 at 7:26
  • Try with <add id="Ktpl_Testimonial::testimonial" title="Manage Testimonials" translate="title" module="Ktpl_Testimonial" sortOrder="0" parent="Ktpl_Testimonial::menu" resource="Ktpl_Testimonial::testimonial"/> – Rakesh Jesadiya Jan 19 '17 at 7:28
1

Try to set resource of root item to Magento_Backend::content

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.