Problem Statement: I have created an adminmenu and call an action on it. For the action, I have created one controller. When click on menu it redirects to 404 page on front side.(Can't access to controller and it jump to frontarea) Code is as below:
config.xml (demo/etc/config.xml)
<?xml version="1.0"?>
<config>
 <modules>
 <Sevenbits_Demo>
 <version>1.0.0</version>
 </Sevenbits_Demo>
 </modules>
 <global>
 <models>
 <demo>
 <class>Sevenbits_Demo_Model</class>
 </demo>
 </models>
 <helpers>
 <demo>
 <class>Sevenbits_Demo_Helper</class>
 </demo>
 </helpers>
 <blocks>
 <demo>
 <class>Sevenbits_Demo_Block</class>
 </demo>
 </blocks>
 </global>
 <!-- Frontend Controller started here -->
 <frontend>
 <routers>
 <demo>
 <use>standard</use>
 <args>
 <frontName>Demo</frontName>
 <module>Sevenbits_Demo</module>
 </args>
 </demo>
 </routers>
 <layout>
 <updates>
 <demo>
 <file>demo.xml</file>
 </demo>
 </updates>
 </layout>
 </frontend>
 <!-- Frontend Controller end here -->
 <!-- Frontend Controller started here -->
 <admin>
 <routers>
 <adminhtml>
 <args>
 <module>
 <demo before="Mage_Adminhtml">
 Sevenbits_Demo_Adminhtml
 </demo>
 </module>
 </args>
 </adminhtml>
 </routers>
 </admin>
 <!-- Frontend Controller end here -->
</config>
adminhtml.xml(demo/etc/adminhtml.xml)
<?xml version="1.0"?>
<config>
 <menu>
 <demo transalte="title" module="demo">
 <title>Mage Hunter</title>
 <sort_order>1000</sort_order>
 <action>Adminhtml/demo</action>
 </demo>
 </menu>
</config>
DemoController.php (/demo/controllers/Adminhtml/DemoController.php)
<?php
class Sevenbits_Demo_Adminhtml_DemoController extends Mage_Adminhtml_Controller_Action
{
 public function indexAction()
 {
 //$this->loadLayout();
 echo "Hwll";
 return $this->renderLayout();
 }
}
After Menu click (page redirect to 404 page and display frontend layout) get this output.
2 Answers 2
remove the new lines in here:
<demo before="Mage_Adminhtml">
 Sevenbits_Demo_Adminhtml
</demo>
make that look like this
<demo before="Mage_Adminhtml">Sevenbits_Demo_Adminhtml</demo>
- 
 still same issueVasim Shaikh– Vasim Shaikh2016年07月18日 11:08:23 +00:00Commented Jul 18, 2016 at 11:08
You need to define layout for it
Create file for it app/design/adminhtml/default/default/layout/demo.xml
add below code to it:
<?xml version="1.0"?>
<layout version="0.1.0">
 <adminhtml_demo_index>
 <reference name="content">
 <block type="demo/adminhtml_demo" name="demo" />
 </reference>
 </adminhtml_demo_index>
</layout>
Also you need to add below code in config.xml file between <adminhtml></adminhtml>
<layout>
 <updates>
 <demo>
 <file>demo.xml</file>
 </demo>
 </updates>
</layout>
Also give the link
<action>adminhtml/demo</action> instead of <action>Adminhtml/demo</action>
- 
 ok @prashant let me checkVasim Shaikh– Vasim Shaikh2016年07月18日 11:16:11 +00:00Commented Jul 18, 2016 at 11:16
- 
 I have already demo.xmlVasim Shaikh– Vasim Shaikh2016年07月18日 11:17:15 +00:00Commented Jul 18, 2016 at 11:17
- 
 Where it is located and what is inside it?Prashant Valanda– Prashant Valanda2016年07月18日 11:18:02 +00:00Commented Jul 18, 2016 at 11:18
- 
 its in frontendVasim Shaikh– Vasim Shaikh2016年07月18日 11:18:34 +00:00Commented Jul 18, 2016 at 11:18
- 
 I just added into adminhtmlVasim Shaikh– Vasim Shaikh2016年07月18日 11:19:44 +00:00Commented Jul 18, 2016 at 11:19