Awais Qarni
Awais Qarni

Reputation: 18006

Magento new extension shows 404 page

I have just started magento. I want to develop a simple magento extension showing helloworld. But when I want to access my extension page by frontname it always shows my 404 error.

I have created a folder Mycompany in app/local. Then I created a folder Tbc. Then I created etc folder and created a config.xml file that looks like

<?xml version="1.0"?>
 <config>
  <modules>
    <Mycompany_Tbc>
        <version>0.1.0</version>
    </Mycompany_Tbc>
 </modules>
 <frontend>
    <routers>
        <tbc>
            <use>standard</use>
            <args>
                <module>Mycompany_Tbc</module>
                <frontName>tbc</frontName>
            </args>
        </tbc>
    </routers>
    <layout>
        <updates>
            <tbc>
                <file>tbc.xml</file>
            </tbc>
        </updates>
    </layout>
 </frontend>
</config>

Then I created a controllers directory in my module directory and created an IndexController.php file in that directory like

class Mycompany_Tbc_IndexController extends Mage_Core_Controller_Front_Action {
/**
 * index action
 */
    public function indexAction() {
        echo 'reached here';
        die();
    }
}

Then I created a Mycompany_Tbc.xml file in app/etc/modules which looks like

<?xml version="1.0" encoding="UTF-8"?>
 <config>
  <modules>
    <Mycompany_Tbc>
        <active>true</active>
        <codepool>local</codepool>
    </Mycompany_Tbc>
  </modules>
</config>

I can see my module enabled in admin panel. But now I want to access magento.local/tbc or magento.local/index.php/tbc, it always gives a 404 error. I have installed this module for better 404 errors and due to this extension the 404 page shows

Page not Found
 We couldn't find a page at the URL you specified. The information below will help a Magento programmer figure out why.

Original Path
Original Path Information /tbc.

Module/Front Name
Module/Front Name: tbc.

No modules claim [tbc] as a <frontName/>`.

I have tried creating many extensions from scratch but getting same error and clearing cache many times. I am using magento 1.9

NOTE I am doing it at localhost and magento.local in my virtual host. I have created virtual host after installation of magento then change the web/unsecure/base_url and web/secure/base_url in config_cache_data table.

Any help will be much appreciated.

Upvotes: 0

Views: 508

Answers (3)

Colin Asquith
Colin Asquith

Reputation: 654

I had a problem like this that was difficult to solve because of a cache plugin, but I found that I had built a module in Windows that worked fine, though it didn't work on Linux.

The reason was because Magento expected the folder to be in:

app/code/local/Mycompany/Tbc/controllers and my folder was named Controllers - case didn't matter on Windows. Took a long time to work out...

Upvotes: 0

esspe
esspe

Reputation: 100

<?xml version="1.0" encoding="UTF-8"?>
 <config>
  <modules>
    <Mycompany_Tbc>

<!-- Whether our module is active: true or false -->

        <active>true</active>

<!-- Which codePool to use: core, community or local -->
        <codePool>local</codePool>
    </Mycompany_Tbc>
  </modules>
</config>

app/code/core - Holds modules that are distributed with the base Magento and make up the core functionality.

app/code/community - Holds modules that are developed by third-parties

app/code/local - Holds custom modules you developed, including Mage code overrides.

Upvotes: 0

Amit Bera
Amit Bera

Reputation: 7611

There are silly mistake in Mycompany_Tbc.xml

<codepool>local</codepool>

should be <codePool>local</codePool>

Upvotes: 1

Related Questions