Magento – New module router index 404 error

magento-1module

I'm attempting to build a module but I can't even get the url routing to work as it keeps responding with a 404. I've follow this tutorial in an attempt to get it working but I still get a 404 page every time.

http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-3-magento-controller-dispatch

This is my folder structure.

app
    code
        local
            Group
                Customnewsletter
                    etc
                        config.xml
                    controllers
                        IndexController.php

My module xml is

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

config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Group_Customnewsletter>
        <version>0.1</version>
    </Group_Customnewsletter>
</module>

 <frontend>
    <routers>
        <customnewsletter>
            <use>standard</use>
            <args>
                <module>Group_Customnewsletter</module>
                <frontName>customnewsletter</frontName>
            </args>
        </customnewsletter>
    </routers>
</frontend>
</config>

IndexController.php

<?php 

class Group_Customnewsletter_IndexController extends Mage_Core_Controller_Front_Action {
    public function indexAction(){
        echo 'hello'; 
    }

}

The module appears under System->Configuration->Advanced and i've checked my syntax and every time i go to store.local/customnewsletter/index/index/ I get a 404 response. Any help would be greatly appreciated.

Best Answer

In your modeule's config.xml check the below portion

<?xml version="1.0"?>
<config>
<modules>
    <Group_Customnewsletter>
        <version>0.1</version>
    </Group_Customnewsletter>
</module> <!-- This should be modules NOT module -->

Corrected code (See below):

<?xml version="1.0"?>
    <config>
    <modules>
        <Group_Customnewsletter>
            <version>0.1</version>
        </Group_Customnewsletter>
    </modules> 

Now your module should work :)

Related Topic