今天给一个客户的站重建索引,先用php indexer.php --reindexall,结果发现生成分类索引的时候提示报错,如下图:
具体信息是:An error occurred while saving the URL rewrite,经过研究发现解决办法如下:
1、通过服务器或者远程登录进入数据库,然后use 对应的数据库,命令是 #mysql -uroot -p,#use longyishop;
2、清空core_url_rewrite,magento系统的重写url链接均在这个表里面,命令是“truncate core_url_rewrite;”。
3、在项目目录下进入根目录下面的shell文件夹,重新执行重建分类索引的命令:php -f indexer.php -- -reindex catalog_url。
最后,特别说明一下,后台功能选项里面可以视图界面生成索引,但由于生成索引需要时间过长,往往会造成后台超时打不开,所以不建议使用后台的可视化操作,大数据生成重写统一命令行下执行。