1

I have create new module, controller and config file. but the route is not working, showing 404.

Controller:

<?php
class Magentotutorial_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {        
    public function indexAction() {
        echo 'Hello World';
    }

    public function goodbyeAction() {
    echo 'Goodbye World!';
    }
}

Config file.

<config>    
    <modules>
        <Magentotutorial_Helloworld>
            <version>0.1.0</version>
        </Magentotutorial_Helloworld>
    </modules>
</config>

<config>    
    ...
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Magentotutorial_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>  
    </frontend>
</config>

Module:

<config>
    <modules>
        <Magentotutorial_Helloworld>
            <active>true</active>
            <codePool>local</codePool>
        </Magentotutorial_Helloworld>
    </modules>
</config>
0

Your module file would be in this path

app/etc/module/Magentotutorial_Helloworld.xml

otherwise I think You have written everything right.

But problem with your mod_rewrite please check with this url

YourBaseURL/index.php/helloworld

And check if its working then enable mod_rewrite in your apache and check again

  • Thanks Murtaza. your given route is also not working. as i given localhost/magento1.9/index.php/helloworld. showing 404 again. routes are working for another project in magento 2. – Khalil ur Rehman Nov 25 '16 at 12:14
  • Please provide full detail of your code including the full path of all files – Murtuza Zabuawala Nov 25 '16 at 12:15
  • app/code/local/Magentotutorial/Helloworld/controllers app/code/local/Magentotutorial/Helloworld/etc/config.xml app/code/local/Magentotutorial/Helloworld/etc/module – Khalil ur Rehman Nov 25 '16 at 12:18
  • @KhalilurRehman your module file should be in app/etc/module/Magentotutorial_Helloworld.xml – Murtuza Zabuawala Nov 25 '16 at 12:38
  • yes it is on same location as you said. – Khalil ur Rehman Nov 25 '16 at 12:51
0

You have closed the config tag and reopened it, this is wrong. Your config.xml should look like this:

<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>
  • @KhalilurRehman how do you access your route ? http//mysite.com/helloworld ? – Raphael at Digital Pianism Nov 25 '16 at 11:57
  • I am accessing this route.localhost/magento1.9/helloworld – Khalil ur Rehman Nov 25 '16 at 11:59
  • @KhalilurRehman ensure your controller file is located in the controllers folder (respect the case). Flush the cache and recompile if you're using the compiler – Raphael at Digital Pianism Nov 25 '16 at 12:00
  • controller folder name is controllers. also cleared cache. but i am not compiling my code. how to compile code in magento 1.9 please ? route still showing same issue. – Khalil ur Rehman Nov 25 '16 at 12:02
  • any other idea ? – Khalil ur Rehman Nov 25 '16 at 12:09

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.