我正在开发一个项目,其中一个名为Namespace_Ticket的模块适合作为发票列表。
但是,访问此模块的URL如下所示:
http://dev.local/index.php/tickets/index/index/ticket_id/9568/
我希望能够从URL中删除“ticket”一词,并将其替换为“invoice”。我希望我的网址如下所示:
http://dev.local/index.php/invoices/index/index/invoice_id/9568/
有没有办法我可以做到这一点,而无需重命名整个模块?
谢谢。
路由器名称在模块的etc/config.xml
文件中定义,您将找到类似于下面的代码
<routers>
<modulename> <!--or this may be ticket -->
<use>standard</use>
<args>
<module>Namespace_Ticket</module>
<frontName>tickets</frontName> <!-- You have to change this value to change the router -->
</args>
</modulename>
</routers>
需要为admin和frontend单独定义路由器,你可以在<frontend>
和<admin>
节点下找到它们。
更改路由器前端名称后,请确保在整个站点中使用URL的任何位置都必须更改路由器。