I'm running a magento installation on an apache server. There are many pages indexed in both google and linked to from external sites.
I can't use 301 redirects in a .htaccess file as I can't be sure I will catch all the links. At the moment all requests are rewritten through magento and if a request isn't found magento returns a 404 File not Found.
Is there a way of using one of the apache modules to filter the response* from magento and if a 404 Not Found is being sent back then replace the response with a standard 301 Redirect to the home page?
Request to Magento --> Apache --> Rewrite to Magento index.php page --> page processed.
Response if request exists --> return results (200) if request doesn't exist --> return 404 --> apache filter change response --> return 301 redirect to /
I appreciate any help.
- as far as I am aware mod_rewrite is only used to rewrite requests and doesn't allow the modification of responses.