I created my custom module under local the name is MyTest/ProductsData, what I need to do is to create the new router so I've been created the IndexController.php and my config.xml, and I already activated my custom module and I checked under system->configuration->advanced which is enabled, the URL I'm trying to test is http://example.com/magento/MyTest/index/ or http://example.com/magento/index.php/MyTest/index/index and any other possible URLs also I tried them, all will go to 404 page and I cannot find any solution to solve this problem :( I really appreciate if any of you can help me out with this.



class MyTest_ProductsData_IndexController extends Mage_Core_Controller_Front_Action
    public function indexAction()
         echo 'me';

    public function addAction()
        echo 'Test add Action';
    public function deleteAction()
        echo 'Test delete Action';

and config.xml file,

<?xml version="1.0"?>
  • May be controller file permission is not set to 777. Dec 22, 2014 at 9:06
  • I already changed the permission to 777 :( Dec 22, 2014 at 9:13
  • Run compilation and remove cache too.. Dec 22, 2014 at 9:22
  • yeah did it already cannot get to the right page :( still get to 404 page! Dec 22, 2014 at 9:27
  • check is your controller file exist in magento includes->src->MyTest->ProductsData directory . Dec 22, 2014 at 9:30

2 Answers 2


If you dont have MyTest_ProductsData.xml inside your app->etc->modules directory create first..

If you have created already,then check your folder structure and give 777 permission to your module root directory MyTest.

After this Run Compilation process in admin and clear the cache and then check .


I have tried your code and it worked for me with this url localhost/magento/MyTest/. Try again..


controller, config.xml .

  • I have, actually I've activated my module inside that file then already checked it through admin panel, system->configuration->advanced, is enabled. Dec 22, 2014 at 9:54
  • @SaghiGhorbani I've edited my answer check it now. Dec 22, 2014 at 10:29
  • I already run compilation process in admin and clear the cache Disabled everything under cache storage management and clear cache again and I tried with the link you gave its so strange It still doesn't work for me !! :( Dec 23, 2014 at 2:42
  • Finally, it worked , thanks for your help :), the problem was I should put the routeName before UrlName, defined in config.xml Dec 23, 2014 at 4:07
  • @SaghiGhorbani sounds good.. Dec 23, 2014 at 4:29

Your router has to be as this.


class Test_Modulename_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract {

    public function initControllerRouters($observer) {

        $front = $observer->getEvent()->getFront();

        $pressrelease  = 'custom_url_identifier';

        $front->addRouter($pressrelease, $this);     


     public function match(Zend_Controller_Request_Http $request) {  
         if (!Mage::isInstalled()) {

        $router_name = 'custom_router_name';
        $identifier = trim($request->getPathInfo(), '/');

        if($router_name != $identifier)
             $pressUrl = explode("/",$identifier);
             $pressUrl = $pressUrl[1];
             if($pressUrl != "")
                $collection = Mage::getModel('pressrelease/pressrelease')->getCollection()->addFieldToFilter('url',$pressUrl);
                 foreach ($collection as $_press)
                    $pressId = $_press['pressrelease_id'];
                    $pressName = $_press['title'];

                        ->setParam('pressrelease_id', $pressId)
                       ->setParam('title', $pressName);
                       return true;
                 $pageId = Mage::getStoreConfig('cms/index/noRoute');
                 $url = rtrim(Mage::getUrl($pageId),'/');
                 return false;


        return true;



In the events section of config.xml, add this:

  • Sry u mean I need to create another file under Controller named Router.php and put this code in? Dec 22, 2014 at 9:15
  • I got 'Front controller reached 100 router match iterations' this error ! Dec 22, 2014 at 9:25
  • You need to comment the frontend section in the config.xml, when you are using this method. Jan 7, 2015 at 4:49

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.