Magento 1.9.2.4 Custom Module – Can’t Reach Controller

ce-1.9.2.4controllersmagento-1magento-1.9module

I have created one module in magento 1.9.2.4 and I want to check front end controller is working or not,but get an error 404 Not Found page.

Config.xml (C:\xampp\htdocs\shop\app\code\local\Sevenbits\Demo\etc\config.xml)

<?xml version="1.0"?>
<config>
    <!-- about modules -->
    <modules>
        <Sevenbits_Demo>
            <version>1.0.0</version>
        </Sevenbits_Demo>
    </modules>


    <!-- Setup  class  path for all things -->
    <global>
        <models>
        <demo>
            <class>Sevenbits_Demo_Model</class>
        </demo>
        </models>

        <blocks>
        <demo>
            <class>Sevenbits_Demo_Block</class>
        </demo>
        </blocks>

        <helpers>
        <demo>
            <class>Sevenbits_Demo_Helper</class>
        </demo>
        </helpers>
    </global>

    <!-- For Frontend Controller-->

    <frontend>
        <routers>
            <demo>
                <use>standard</use>
                <args>
                    <frontName>demo</frontName>
                    <module>Sevenbits_Demo</module>
                </args>
            </demo>
        <routers>
    </frontend>

</config>

IndexController.php (C:\xampp\htdocs\shop\app\code\local\Sevenbits\Demo\controllers\IndexControllers.php)

<?php


class Sevenbit_Demo_IndexControllers extends Mage_Core_Controller_Front_Action
{

    public function indexAction()
    {

            echo "Hello World";
    }


}

Sevebits_Demo.xml (C:\xampp\htdocs\shop\app\etc\modules\Sevenbits_Demo.xml)

<?xml version="1.0"?>
<config>
    <modules>
        <Sevenbits_Demo>
            <active>true</active>
            <codePool>local</codePool>
        </Sevenbits_Demo>
    </modules>
</config>

You can find full source code here :
https://drive.google.com/file/d/0B8PWEkckbXCUNkpQZ2N6eEM3a1E/view?usp=sharing

Best Answer

you need to change in two files as below in your module,

1./app/code/local/Sevenbits/Demo/controllers/IndexController.php class name is wrong, replace with below code,

<?php


class Sevenbits_Demo_IndexController extends Mage_Core_Controller_Front_Action
{

    public function indexAction()
    {

            echo "Hello World";
    }


}

2. config.xml

<!-- For Frontend Controller-->

    <frontend>
        <routers>
            <demo>
                <use>standard</use>
                <args>
                    <frontName>demo</frontName>
                    <module>Sevenbits_Demo</module>
                </args>
            </demo>
        </routers>
    </frontend>

Note: After I made this two changes in your module, I am getting below response in my browser when i run url, http://localhost/magento1924/index.php/demo/index

https://drive.google.com/file/d/0B1aJL9nhfbfFRzNTdGwzYWxFR0k/view?usp=drivesdk