EcomDev_UrlRewrite
EcomDev_UrlRewrite copied to clipboard
"-1" at the end of product url
I don't know if this project is alive but maybe someone will help me. When using this module urls have "-1" at the end, and it redirects from "normal" to "-1", e.g. "product-a.html" to "product-a-1.html"
It works for basic product urls, but in category it doesn't: "cat1/product-a.html" is 404 "cat1/product-a-1.html" is 200
Also rel=canonical is now "cat1/product-a-1.html".
How to get rid of this "-1" part? Of course it should be left for duplicates (if occur), so they will have "-2", "-3", ... I think it is the reason, but why 1st is treated as duplicate?
@mkutyba - did you ever solve this issue?
possible solution: https://github.com/EcomDev/EcomDev_UrlRewrite/pull/22
#22 should be fine, I made something similar to this
Just to reiterate the bug for people that are unaware.
If your url key ends with an integer, then the indexer code will append "-1" to the end of the product url.
@mkutyba Can you share your regex please?
Mine is here https://github.com/mkutyba/EcomDev_UrlRewrite/commit/8d181d270d66562b75563ad38df237b74eae15c2 But changes proposed by @ProxiBlue seem to be better. They need some unit tests.