【问题标题】:making Url user friendly in magento在 magento 中使 Url 用户友好
【发布时间】:2015-03-02 10:08:45
【问题描述】:

这是我的自定义模块网址http://192.168.1.18/upload/index.php/capsync/

我想从控制器apiaction 调用下一个操作:

http://192.168.1.18/upload/index.php/capsync/index/api

但删除网址中的index

http://192.168.1.18/upload/index.php/capsync/api

我的 config.xml 页面

<rewrite>
    <Livelids_Capsync>
        <from><![CDATA[#^capsync/index/api/#]]></from>
        <to><![CDATA[api]]></to>
        <complete>1</complete>
    </Livelids_Capsync>
</rewrite>

【问题讨论】:

  • 你好。清晰的前后和正确的格式有助于了解您的需求。

标签: php magento module


【解决方案1】:

在 Magento 中,路由器将按如下方式解析您的 URL: http://yoursite.com/[frontName]/[actionControllerName]/[actionMethod ]/

在您的情况下,对于 URL:http://192.168.1.18/upload/index.php/capsync/index/api

frontName :: capsync

actionControllerName :: indexController

actionMethod :: apiAction

上面是正是你想要的控制器中的下一个动作是'apiAction'

同样,如果你想要网址:http://192.168.1.18/upload/index.php/capsync/api

然后您的 actionControllerName 将完全转向另一个控制器(apiController)和操作(默认为 indexAction),这就是 我不认为你想要

如果您不明白,请告诉我。谢谢! :)

【讨论】:

猜你喜欢
  • 2013-11-20
  • 1970-01-01
  • 2012-07-05
  • 2012-04-25
  • 2013-08-15
  • 1970-01-01
  • 1970-01-01
  • 2010-12-27
相关资源
最近更新 更多