Ashfame
Ashfame

Reputation: 1759

Magento admin controller gives 404

From the instructions at Alan's blog, I have added the router in my config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Clean_Integration>
            <version>1.0.0</version>
        </Clean_Integration>
    </modules>
    <admin>
        <routers>
            <wellnesscoach_app_redirect>
                <use>admin</use>
                <args>
                    <module>Clean_Integration</module>
                    <frontName>appsync</frontName>
                </args>
            </wellnesscoach_app_redirect>
        </routers>
    </admin>
</config>

And then I have my controller defined here app/code/local/Clean/Integration/Controllers/IndexController.php :

<?php

die('checkpoint1');

class Clean_Integration_IndexController extends Mage_Adminhtml_Controller_Action {

    public function indexAction() {
        $this->_redirectUrl('/appointments/sync/backend/');
        die('checkpoint2');
    }
}

When I try to open this url, it goes to the frontend side and throws a 404.

What's causing magento to not pick up this admin router?

Upvotes: 1

Views: 4779

Answers (3)

Kwaga
Kwaga

Reputation: 1

For future reference to anyone else with this problem:

If your controller does not use the standard name of IndexController.php, you will still need to name both the file name and the class name within using the ...Controller convention.

So, if your controller lives in the Adminhtml folder, name it ExtensionController.php and name the class within My_Module_Adminhtml_ExtensionController extends ...

Credit to goes to this excellent article. HTH.

Upvotes: 0

MagePal Extensions
MagePal Extensions

Reputation: 17656

<?xml version="1.0"?>
<config>
  <modules>
      <Clean_Integration>
          <version>1.0.0</version>
      </Clean_Integration>
  </modules>
  <admin>
    <routers>
        <integration>
            <use>admin</use>
            <args>
                <module>Clean_Integration</module>
                <frontName>appsync</frontName>
            </args>
        </integration>
    </routers>
  </admin>

Should be lower case controllers

app/code/local/Clean/Integration/controllers/IndexController.php

You may also want to put this in Adminhtml folder so that you dont run into issue in the future if you want to add a frontend and a admin controller.

app/code/local/Clean/Integration/controllers/Adminhtml/IndexController.php

Upvotes: 4

Lucas Moeskops
Lucas Moeskops

Reputation: 5443

One mistake I see you made is putting the controller in a folder called 'Controllers' instead of 'controllers' (case mistake).

Upvotes: 1

Related Questions