在SEO中有个需求:
Product URL Suffix为“/”,Category URL Suffix为“/”
但在实际的测试中,发现:
Product URL Suffix为“/”,Category URL Suffix为“/” :失败
Product URL Suffix为“-”,Category URL Suffix为“-” :成功
Product URL Suffix为“”,Category URL Suffix为“/” :成功
最后发现了原来这是旧版本的magento的一个bug,详细可参见:
http://www.magentocommerce.com/bug-tracking/issue?issue=9474
只要把app/code/core/Mage/Core/Model/Url/Rewrite.php中199行:
$requestPath = trim($request->getPathInfo(), '/');
改为
$requestPath = ltrim($request->getPathInfo(), '/');
就行了