utabtech utabtech - 1 year ago 43
PHP Question

magento 404 not found

I am new in magento . I fallow its tutorial and create my first module.
but it's returns 404 not found:

config.xml file is below:

<?xml version='1.0'?>
<config>
<modules>
<Magentotutorial_Helloworld>
<version>0.1.0</version>
</Magentotutorial_Helloworld>
</modules>

</config>


and Magento_Helloworld.xml is:

<config>
<modules>
<Magentotutorial_Helloworld>
<active>true</active>
<codePool>local</codePool>
</Magentotutorial_Helloworld>
</modules>
<frontend>
<routers>
<helloworld>
<use>standard</use>
<args>
<module>Magentotutorial_Helloworld</module>
<frontName>helloworld</frontName>
</args>
</helloworld>
</routers>
</frontend>
</config>


and the controller is :

class Magentotutorial_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {

public function indexAction() {
die( 'Hello Index!');
}

}


now I try

http://127.0.0.1/magento/index.php/helloworld/index/index


and see 404 page! where is the problem?

I cleared cache from admin!

Answer Source

The content of your xml files should looks like this: 'app/etc/modules/Magentotutorial_Helloworld.xml':

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

'app/code/local/Magentotutorial/Helloworld/etc/config.xml':

<?xml version="1.0"?>
<config>    
    <modules>
        <Magentotutorial_Helloworld>
            <version>0.1.0</version>
        </Magentotutorial_Helloworld>
    </modules>
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Magentotutorial_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>  
    </frontend>
</config>

P.S. controller should be in the 'app/code/local/Magentotutorial/Helloworld/controllers/' directory

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download