I currently have this code in my .htaccess file
RewriteCond %{QUERY_STRING} !product_id=(.*)
RewriteRule ^(.*)$ http://www.myurl.com/index.php [R=301]
This 301 redirects product URLs to my root directory based on product ID. (I didn't make it I got it from someone else)
What I need to do is keep this rule in place whilst redirecting any 404 pages in the same directory to the homepage.