简体   繁体   English

添加Magento系统URL重写

[英]Adding Magento System URL Rewrite

I accidentally deleted some System URL rewrites while attempting to do some 301 redirect magic (ie getting one subcategory to direct to another category because they were duplicates but in different parent categories). 尝试执行301重定向魔术时,我不小心删除了一些系统URL重写(即,将一个子类别定向到另一类别,因为它们是重复的,但在不同的父类别中)。

After deleting these system URL rewrites I realised that the URLs aren't "pretty" for SEO purposes. 删除这些系统URL重写后,我意识到这些URL对于SEO而言不是“漂亮”的。 For example I deleted a system URL rewrite that was: 例如,我删除了一个系统URL重写:

flow-meters

/catalog/category/view/s/flow-meters/id/481/

basically, now every time I click on this category, I get /catalog/category/view/s/flow-meters/id/481/ whereas I want the URL to say something similar to sprayers/flow-meters . 基本上,现在每次单击此类别时,我都会获得/catalog/category/view/s/flow-meters/id/481/而我希望URL表示类似于sprayers/flow-meters Is there a way to add this into Magento via the dashboard? 有没有办法通过仪表板将此添加到Magento? Or do I have to play around with the database tables? 还是我必须摆弄数据库表?

Any help would be appreciated. 任何帮助,将不胜感激。

You should be able to regenerate Magento's standard URL rewrites by reindexing your system. 您应该能够通过重新索引系统来重新生成Magento的标准URL重写。 Specifically, the Catalog URL index needs rebuilding. 具体来说,目录URL索引需要重建。

You can do this programmatically via the CLI interface with the following 您可以通过CLI界面以编程方式执行以下操作

$ php shell/indexer.php --reindex catalog_url

Or, per your question, via the backend backend admin application at 或者,根据您的问题,通过后端后端管理应用程序

System -> Index Management

I went into core_url_rewrite table inside the database and manually inserted rows to match the category IDs. 我进入了数据库内部的core_url_rewrite表,并手动插入了与类别ID相匹配的行。 Then clearing the cache in System --> Cache Management seemed to make the system work fine. 然后在“ System --> Cache Management清除缓存似乎可以使系统正常运行。

Take a backup of core_url_rewrite table and truncate it. 备份core_url_rewrite表并截断它。 Then clear cache and then reindex the "Catalog URL Rewrites" from magento Index Management configuration. 然后清除缓存,然后从magento索引管理配置中为“目录URL重写”重新索引。

Also before reindex ensure the setting of "Search Engine optimization" in web setting is enabled. 同样,在重新索引之前,请确保已启用Web设置中的“搜索引擎优化”设置。

This way I solved my problem. 这样我解决了我的问题。

Hope this will help 希望这会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM