3

I have problem to acces the custom module frontend controller.

I am following a basic tutorial to build a custom module. These are the files I've edited:

/var/www/html/magento/app/etc/modules/WaPoNe_Helloworld.xml

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

/var/www/html/magento/app/code/WaPoNe/Helloworld/controllers/ IndexController.php

  class WaPoNe_Helloworld_IndexController extends 
                     Mage_Core_Controller_Front_Action {

       public function indexAction() {
              echo 'Hello World!';
       }
    }

/var/www/html/magento/app/code/WaPoNe/Helloworld/etc/config.xml

 <?xml version="1.0" encoding="UTF-8"?>
    <config>
      <modules>
        <WaPoNe_Helloworld>
            <version>1.0.0</version>
        </WaPoNe_Helloworld>
      </modules>
    <frontend>
       <routers>
         <helloworld>
            <use>standard</use>
            <args>
              <module>WaPoNe_Helloworld</module>
              <frontName>helloworld</frontName>
            </args>
          </helloworld>
       </routers>
     </frontend>
  </config>

When I try to access the module frontend with this link:

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

I get error 404 not found.

  • Did you clear cache from admin? – Rohan Hapani Sep 26 '18 at 16:59
  • cache is disabled. – blob Sep 26 '18 at 17:00
  • Please check my answer and let me know if any issue. – Rohan Hapani Sep 26 '18 at 17:07
1

You need to add your code into local or community folder :

Follow this below code and add in your file :

/app/etc/modules/WaPoNe_Helloworld.xml

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

/app/code/local/WaPoNe/Helloworld/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
    <config>
      <modules>
        <WaPoNe_Helloworld>
            <version>1.0.0</version>
        </WaPoNe_Helloworld>
      </modules>
    <frontend>
       <routers>
         <helloworld>
            <use>standard</use>
            <args>
              <module>WaPoNe_Helloworld</module>
              <frontName>helloworld</frontName>
            </args>
          </helloworld>
       </routers>
     </frontend>
  </config>

/app/code/local/WaPoNe/Helloworld/controllers/IndexController.php

class WaPoNe_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
   public function indexAction() {
          echo 'Hello World!';
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.