Developer forum

Forum » Development » Automatically create redirects when product URLs change

Automatically create redirects when product URLs change

Ferri Halfhide
Reply

Hi Team,

We’re looking into implementing this ourselves through custom code and were wondering if anyone has already built something similar or could point us in the right direction.

Our use case is the following:

* Product URLs are generated based on the product name and category/channel path.
* When a product name (or category/channel name) changes, the product URL changes as well.
* We’d like to automatically create a 301 redirect from the old URL to the new one whenever this happens.

Care suggested implementing this by listening to:

* Notifications.Ecommerce.Product.BeforeSave
* Notifications.Ecommerce.Product.AfterSave

and then creating redirects using the Dynamicweb.Frontend.DirectPath.Path API.

Before we start building this, I was wondering:

* Has anyone already implemented something similar?
* Are there any examples or code snippets available?
* Are there any pitfalls we should be aware of (multiple product groups, multilingual URLs, meta URLs, redirect chains, etc.)?

Any guidance or experience would be greatly appreciated.

Thanks in advance!


Replies

 

You must be logged in to post in the forum