I have custom a module.
When I do getUrl, it shows:
http://localhost/magento2_beta/index.php/faq/category/view/tags/abc/
So I want an url like: http://localhost/magento2_beta/tag.phtml
How to do it?
magento2magento2-dev-beta
I have custom a module.
When I do getUrl, it shows:
http://localhost/magento2_beta/index.php/faq/category/view/tags/abc/
So I want an url like: http://localhost/magento2_beta/tag.phtml
How to do it?
Best Answer
You may use native rewrite functionality by using menu Marketing->(SEO & Search)->Url Rewrites
Or if you want to implement your own advanced routing - Magento 2 allows to declare your own routers:
Create your router that implements
Magento\Framework\App\RouterInterface
Declare your router as additional argument for
Magento\Framework\App\RouterList
in your di.xml.See example: https://github.com/magento/magento2/blob/merchant_beta/app/code/Magento/Cms/Controller/Router.php
https://github.com/magento/magento2/blob/merchant_beta/app/code/Magento/Cms/etc/frontend/di.xml