1

I've a module to create Brands. So when see a brand detail I get an url like http://magento2.lan/brand/view/index/id/1/

And I would like the url looks http://magento2.lan/brand/view/brandName

I searched on the net but I only found examples about stores. Can you help me please ?

1

It is because the param id is passing by method get. There would be investigate which part of the module is passed that parameter by get and overwrite it to pass it by post.

  • Maybe but then how I can change /id/1 to /brandName ? – Kpone Dec 29 '16 at 15:52
1

In your config.xml you do somthing like this

<global>
   <rewrite>
        <url_brands>
                <from><![CDATA[\/brand\/view\/([-_A-Za-z0-9]*)\/?$]]></from>
                <to><![CDATA[/brand/view/index/$1/]]></to>
                <complete>1</complete>
            </url_brands>
   </rewrite>
</global>

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.