0

我正在使用magento 1.7。magento 产品 url 就像http://example.com/men/silver-cufflinks我想men从 url 中删除一样。我在 url.php 中评论了以下代码

// if (null === $parentPath) {
       // $parentPath = $this->getResource()->getCategoryParentPath($category);
   // }
  //  elseif ($parentPath == '/') {
        $parentPath = '';
   // }

然后清空 core_url_rewrite 表,然后清除缓存并重新索引所有项目,现在我有了http://example.com/catalog/category/view/s/women/id/181/. 我想恢复以前的链接,请告诉我该怎么做。我也再次尝试取消注释我已评论的代码,然后再次清除表格并清除缓存,然后重新索引所有内容,但我仍然无法修复

4

4 回答 4

1

看看@ Fixing URL Rewrites with Magento

要从产品 url 中删除类别路径,您可以从 magento 管理员处进行

转到管理 -> 系统 -> 配置 -> 目录

然后在“搜索引擎优化”下将“使用产品 URL 的类别路径”设置为“否”

在此处输入图像描述

于 2012-12-08T14:59:21.563 回答
0

取消注释代码后,尝试手动清理 url-rewrite 表,然后再次运行 url-rewrites reindex。

于 2012-12-09T06:10:09.433 回答
0

您是否启用了 URL 重写?

系统 -> 配置 -> Web -> 搜索引擎优化 -> 使用 Web 服务器重写 = 是

此外,您还可以检查:

目录 -> URL 重写管理

这个链接: http: //www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index

于 2012-12-09T16:00:04.820 回答
0

我通过 magento-catalog-click 有问题的目录解决了这个问题,然后转到“url key”并将其更改为您想要的。确保在每个商店视图中更改它,然后单击“保存”。

例子:

Catalog
  → General Information
    → Name: Friends
    → Is active: Yes
    → URL key: friends
Store View: English French German

这些更改将重写所有子类别。

于 2017-03-06T14:43:44.840 回答