Magento 1 – Custom Router Leading to 404 Page

404-pagemodulerouter

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.

IndexController.php

<?php

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"?>
<config>
    <modules>
        <MyTest_ProductsData>
            <version>1.0.0</version>
        </MyTest_ProductsData>
    </modules>
    <global>
        <helpers>
            <mytest_productsdata>
                <class>MyTest_ProductsData_Helper</class>
            </mytest_productsdata>
        </helpers>
    </global>
    <frontend>
        <routers>
            <MyTest>
                <use>standard</use>
                <args>
                    <module>MyTest_ProductsData</module>
                    <frontName>MyTest</frontName>
                </args>
            </MyTest>
        </routers>
    </frontend> 
</config>

Best Answer

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 .

EDIT

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

FILES

controller, config.xml .

Related Topic