从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; }
- Apache:确认
- 核对基础URL配置:后台
Stores > Configuration > General > Web下,Base URLs和Base URLs (Secure)的域名需与当前访问域名完全一致,避免域名不匹配导致重写失效。
搜索页面无产品问题排查步骤
- 确认Elasticsearch配置与状态:
- 执行命令验证搜索引擎设置:
需返回bin/magento config:show catalog/search/engineelasticsearch7。 - 检查索引状态:
确保bin/magento indexer:statuscatalogsearch_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命令查看索引情况:
确认Magento生成的产品索引(通常命名为curl -X GET 'http://localhost:9200/_cat/indices?v'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
相关产品推荐
相关产品推荐

