【问题标题】:Magento - Add 301 redirect for all products (approximately 6000 products)Magento - 为所有产品添加 301 重定向(大约 6000 个产品)
【发布时间】:2019-04-06 16:51:58
【问题描述】:

我想在产品的 URL 中添加产品类别,并为 Magento 网站添加从旧 URL(无类别)到新 URL(有类别)的 301 重定向。 有近 6000 种产品,有 30 个不同的类别,因此无法在 .htaccess 中添加所有重定向。

这是我正在尝试做的示例-
旧网址看起来像 - http://domainname.com/product-name.html
新 URL 看起来像 - http://domainname.com/category/product-name.html

配置 URL 很容易,但我想为 SEO 添加 301 重定向。
这样,如果有人在搜索结果中点击旧 URL - http://domainname.com/product-name.html,那么他应该被重定向到 http://domainname.com/category/product-name.html
谢谢。

【问题讨论】:

    标签: php magento redirect http-status-code-301


    【解决方案1】:

    您可以编写自定义脚本,也可以添加自定义 rewrite magento

    1. 以编程方式获取所有产品集合 (Magento - get product collection of all products)
    2. 添加magento core/url_rewrite表(https://gist.github.com/byjujohn/5508233)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多