I am working on Magento 1.9.1. I we have few already deleted products. Currently if we open that by URL we are getting 404. But I want to redirect these all in their parent category. Is there any event by we can handle 404 ? Any way by we can redirect to category page if product not found ?
The solution I think for now is to create a custom 404.html (name as you want) page containing blocks and sections of categories you want (layout).
Then, you edit your .htaccess adding the code:
ErrorDocument 404 /404.html
Make sure the .htaccess is saved on the root directory.
From this, every time your website runs a 404 error, the routine will call the 404.html page (or the page you want to call associated to your root website folder)
Hope that helps