【发布时间】:2017-12-17 11:11:16
【问题描述】:
将 Magento 升级到 1.9.3.4 时,它覆盖了 .htaccess 文件,现在我留下了 2000 多个我手动创建的断开链接。
由于旧产品 URL 的末尾有一个随机数,而现在它们没有,所以我正在寻找一种方法来重定向它们。
旧网址结构:
http://example.com/category-1/subcategory/product-name-1421.html
http://example.com/category-2/subcategory/product-name-5421.html
http://example.com/category-3/subcategory/product-name-5891.html
新的 URL 结构:
http://example.com/category-1/subcategory/product-name.html
http://example.com/category-2/subcategory/product-name.html
http://example.com/category-3/subcategory/product-name.html
我知道我可以使用像 RewriteRule ^category/subcategories/(.+?)(-[0-9]+)?$ category/subcategories/$1 [L,R=301] 这样的 RegExp,但我无法让它工作。
【问题讨论】:
-
为什么不简单地从备份中获取旧的
.htaccess文件? -
@arkascha 我希望我有一个备份副本。我的那个没有
.htaccess文件。 -
听到这个消息很难过。但是那发生了......我希望我下面的回答有所帮助;-)
标签: .htaccess magento redirect mod-rewrite