5

I have :

<?php
class Example_Module_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()

which I can call with http://www.example.com/module/index/index or http://www.example.com/module/ where index/index is inferred.

However I want to be able have different params in the URL and a short URL. Therefore I want to send anything that goes to http://www.example.com/module/ to my module and regard anything after 'module' as parameters.

Therefore rather than http://www.example.com/module/index/index/id/5 I want http://www.example.com/module/id/5

How can I achieve that?

  • what is your module name? – Amit Bera Oct 14 '14 at 16:26
  • anything - it does not have to be anything other than a frontname. – Henry's Cat Oct 14 '14 at 16:48
12

You could try using a magento rewrite

In your config.xml

...
<global>
    <rewrite>
    <fancy_url>
            <from><![CDATA[/module\/(.*)/]]></from>
            <to><![CDATA[module/index/index/id/$1/]]></to>
                <complete>1</complete>
    </fancy_url>
  ...
| improve this answer | |
  • That actually works! I sound surprised, which I am. Thank you very much! – Henry's Cat Oct 14 '14 at 16:56

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.