Tell me how you can implement, and whether it is possible to do this at all. There is a catalog and links such as example.com/catalog/section/subsection/item/ Now if you delete this product, then this link will give you the heading 404 (which is great) and draws the main page of the catalog. Is it possible to make it so that it does not draw the main catalog, but the section in which this product was.
For example, example.com/catalog/section/subsection/ for example.com/catalog/section/subsection/item/
and example.com/catalog/section/ for example.com/catalog/section/item/