I am still rolling this out to other parts of the website, but here is the new 404 page format https://pillser.com/engineering/2024-06-10-website-without-4...
As described elsewhere, here is how the new logic will work:
- I will track which URLs are associated with which products
- If user hits 404, I will check if there was previously a product associated with that URL and redirect accordingly
- If it is a new 404, I will display a 404 page which lists products with similar names
Someone could seriously mess up your site by simply publishing their own page with many invalid links to your site, basically a dictionary attack, and if Google was to crawl those links, they'll cache all the redirects, and you'll have a hard time rectifying that if you were wanting to then publish pages on those URLs.
Also to reiterate other suggestions - your idea is not great for many reasons already stated (even with 302s). As suggested, just simply have a 404 page with a "Did you mean [x]?" instead. Use your same logic to present [x] in that example, rather than redirect to it.