I have an e-commerce website already built. In that, the product page route looks like
https://localhost:5000/product/{productId}
I have implemented it in razor pages by using the @page directive as
@page https://localhost:5000/product/{productId}
Now I have spoken to an SEO developer they wanted URL's with SLUG for SEO purposes as shown below
@page https://localhost:5000/product/{SLUG?}/{productId}
To achieve this URL, I have used ? to make an attribute in URL optional and changed the route basically. But the problem is that I have used `<a href="/product/{productId}" in many
other places, so I can't change the URL directly with a slug.
so I have decided that all the <a> that uses the previous URL as https://localhost:5000/product/{productId} should be permanent redirected to https://localhost:5000/product/{SLUG?}/{productId}
How can I redirect from one URL to another without adding a separate page and pagemodel to take hit on the route and then redirect?