You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从Magento 1.9.2迁移至2.4.6-p5后分类URL报404求解决方案

分类URL 404问题排查步骤
  • 检查URL重写记录:查看数据库url_rewrite表,筛选entity_type='category'的条目,确认迁移后的分类是否有对应的URL重写记录。若缺失,执行以下命令重新生成:
    bin/magento indexer:reindex catalog_url_rewrite
    bin/magento cache:flush
    
  • 验证分类基础配置:后台进入对应分类编辑页,确认启用状态为是,URL键无特殊字符(Magento 2对URL键的规范更严格),且在导航中显示选项开启。
  • 检查服务器重写配置:
    • Apache:确认mod_rewrite模块已启用,根目录.htaccess文件中的重写规则未被修改。
    • Nginx:确认配置文件中包含将请求转发到index.php的rewrite规则,比如:
      location / {
          try_files $uri $uri/ /index.php$is_args$args;
      }
      
  • 核对基础URL配置:后台Stores > Configuration > General > Web下,Base URLs和Base URLs (Secure)的域名需与当前访问域名完全一致,避免域名不匹配导致重写失效。
搜索页面无产品问题排查步骤
  • 确认Elasticsearch配置与状态:
    1. 执行命令验证搜索引擎设置:
      bin/magento config:show catalog/search/engine
      
      需返回elasticsearch7。
    2. 检查索引状态:
      bin/magento indexer:status
      
      确保catalogsearch_fulltext索引状态为Ready,否则执行:
      bin/magento indexer:reindex catalogsearch_fulltext
      bin/magento cache:flush
      
  • 检查产品可搜索属性:后台Stores > Attributes > Product,确认用于搜索的核心属性(如名称、描述)的Use in Search和Visible in Search Results均设为Yes。
  • 验证产品状态:确保产品启用、库存有货,且可见性设置为Catalog, Search,同时已正确关联到对应分类。
  • 检查Elasticsearch索引数据:
    用curl命令查看索引情况:
    curl -X GET 'http://localhost:9200/_cat/indices?v'
    
    确认Magento生成的产品索引(通常命名为magento2_product_1_vX)存在且文档数不为0。若索引为空,执行:
    bin/magento indexer:reset catalogsearch_fulltext
    bin/magento indexer:reindex catalogsearch_fulltext
    
  • 核对搜索配置:后台Stores > Configuration > Catalog > Catalog Search,确认Minimum Query Length设置合理(如1或2),Search Type选择Elasticsearch。

内容的提问来源于stack exchange,提问作者sunil verma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 22:24:59