更新时间:2023-11-30 15:04:10
您很有可能想要编写一个脚本来为您执行此操作,并将其保留在Magento的URL管理中,而不是一些难以处理的清单.htaccess等文件中的重写/重定向.
More than likely you're going to want to write a script to do this for you and keep it within Magento's URL Management instead of some long un-manageable list of rewrites/redirects in .htaccess or such.
我认为您最大的问题是存在相同文件名的任何冲突以及您将如何处理此类冲突.
Your biggest issue I would think would be any collisions where the same filename exists and how you would want to handle such.
Mage::getModel('core/url_rewrite')
->setIsSystem(0)
->setStoreId($storeId)
->setOptions('RP')
->setIdPath('index.php?cat=c' . $categoryId . '_' . $this->strip($data['name']) . '.html')
->setTargetPath($categoryModel->getUrlPath() . '.html')
->setRequestPath('index.php?cat=c' . $categoryId . '_' . $this->strip($data['name']) . '.html')
->save();
这只是如何在Magento的URL Rewrite Manager中添加重写的示例.
This is just an example of how to add rewrite's into Magento's URL Rewrite Manager.