Permanent Redirect urls - configuration

10 mesi tempo fa
Hi

We have a webshop with a lot of messed up product urls with almost the same name, except for a "-2" or "-3" in the end.
I have deleted those that were duplicates, but would now like the old urls to permanent redirect (301) to the main url of the product. Right now they end up in a (404) Page not found, and that is not good google-wise or customer-wise.

How can i overwrite the RouteProvider to make it possible to configure where certain urls redirect to. Or is there another way of solving this?

I am using version 4.50.

Best regards,
Axel
10 mesi tempo fa
If you hadn't deleted UrlRecord entries, but marked them as inactive (IsActive = false), RouteTransformer would have done the trick. See this code for details.
10 mesi tempo fa
Ahhh great, but how do normal operators  avoid deleting the slug, when they delete a product?
10 mesi tempo fa
RomanovM wrote:
If you hadn't deleted UrlRecord entries, but marked them as inactive (IsActive = false), RouteTransformer would have done the trick. See this code for details.


I have an additional question:
Should this also work for Category?
10 mesi tempo fa
Actually, the slugs are not deleted when an object (product, category, etc) is deleted. They can be deleted on the Admin → System → Search engine friendly page names page.

AxelAndersen wrote:

Should this also work for Category?

Yep, this works the same for all ISlugSupported entities.
10 mesi tempo fa
Thanks, its working like a charm,.. once i figured out how it worked :-)