How to cut short the URL of a controller action page in magento2
For instance:
If custom modules controller page is in : Vendor/Module/Controller/Index/Index.php
in routes.xml
: I had defined frontname as : i
Instead of navigating to : localhost/magento/i/index/index
How to optimize the URl to only localhost/magento/i
Basically , i need to achieve this (as in magento1) in Magento2.
<!-- url rewrite -->
<rewrite>
<mypage>
<from><![CDATA[#^/([\w-]+)/m/?#]]></from>
<to><![CDATA[/m/index/index/product/$1]]></to>
<complete>1</complete>
</mypage>
</rewrite>
<!-- end url rewrite -->
<frontend>
<routers>
<mypage>
<use>standard</use>
<args>
<module>Vendor_Module</module>
<frontName>m</frontName>
</args>
</mypage>
</routers>
For the above rewrite : we can get the controller action just by:
localhost/magento/m
Need to achieve the same in Magento2 ?
UPDATE:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="m" frontName="m">
<module name="Vendor_Module"/>
</route>
</router>
Controller path: \Vendor\Module\Controller\Result\Index.php
layout file name: m_result_index
URL: localhost/magento/m
I get 404 no found.
Cleared cache and gen