1

I'm following the answer to stackoverflow question 576908 but I seem to be getting a 404 Error. Does anyone know what I'm doing wrong. i.e. beginner mistakes?

IndexController:

    <?php
      class MyCompanyName_HelloWorld_IndexController extends         Mage_Core_Controller_Front_Action{
    public function indexAction(){
        echo "We're echoing just to show that this is what's called, normally you'd have some kind of redirect going on here";
    }
}

Config.xml:

<?xml version="1.0"?>
  <config>
 <modules>
    <mycompanyname_helloworld>
        <version>
            0.1.0
        </version>
    </mycompanyname_helloworld>
</modules>
<frontend>
    <routers>
        <!-- the <helloworld> tagname appears to be arbitrary, but by
        convention is should match the frontName tag below-->
        <helloworld>
            <use>standard</use>
            <args>
                <module>MyCompanyName_HelloWorld</module>
                <frontName>helloworld</frontName>
            </args>
        </helloworld>
    </routers>
</frontend>
</config>

In app/etc/modules:

<?xml version="1.0"?>
<config>
<modules>
    <MyCompanyName_Helloworld>
        <active>true</active>
        <codePool>community</codePool>
    </MyCompanyName_Helloworld>
</modules>
</config>

I keep geeting a

404 Error

when I hit the url magento.dev/index.php/helloworld
//NB The url is a virtualhost on my development machine.

A screen shot of the 404

I'm running magento 1.8

Community
  • 1
  • 1
acquayefrank
  • 474
  • 5
  • 21

2 Answers2

1

Make sure to have everything in your config consistently named (e.g. in camel case):

/app/etc/modules/MyCompanyName_HelloWorld.xml

<?xml version="1.0"?>
<config>
<modules>
    <MyCompanyName_HelloWorld>
        <active>true</active>
        <codePool>community</codePool>
    </MyCompanyName_HelloWorld>
</modules>
</config>

/app/code/community/MyCompanyName/HelloWorld/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <MyCompanyName_HelloWorld>
            <version>
                0.1.0
            </version>
        </MyCompanyName_HelloWorld>
    </modules>
...

The full call to that would be magento.dev/index.php/helloworld/index/index/.

These should work as well:

magento.dev/index.php/helloworld/index/

magento.dev/index.php/helloworld/

Got it to work for me that way.

Carsten
  • 56
  • 5
0

Try magento.dev/index.php/helloworld/index You passed frontName in url, but didn't pass controller name to the url. BTW, use local code pull for your extensions.

Valery Statichny
  • 593
  • 7
  • 22
  • Statichny, that does not work. Also I'm trying to build a community extension hence according to the magento documentation my code should exist in the community directory – acquayefrank Jul 23 '15 at 16:06