1

In particular, I'm working on a Magento site with a custom module that is only accessible if you include /index/ at the end of the module's frontend route. So the route is setup like this:

<frontend>
    <routers>
       <mycompany_mymodule>
           <use>standard</use>
           <args>
               <module>Mycompany_Mymodule</module>
               <frontName>shortname</frontName>
           </args>
       </mycompany_mymodule>
    </routers>
</frontend>

On some servers and local installs of the site, example.com/shortname/ works. However, on others you get a 404 unless you go to example.com/shortname/index/

This leads me to a few questions:

  1. Any idea what causes the requirement for /index/ in the route on some servers?
  2. As a whole, are "index" as a default controller and "index" as a default action hard coded into Magento or is it something that can be customized per module?
  3. Particularly where in the code does Magento look for "index" controllers and actions?

1 Answer 1

3

Mage_Core_Controller_Varien_Router_Standard::fetchDefault()

The above function call from Mage_Core_Controller_Varien_Router_Standard::match()

set's the default values on the Front Controller. These defaults are then retrieved while the standard router (similarly other routers) are trying to match a request to a controller class and action.

public function fetchDefault()
{
    $this->getFront()->setDefault(array(
        'module' => 'core',
        'controller' => 'index',
        'action' => 'index'
    ));
}

I think this should answer 2,3 for you. Not sure about the 1st.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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