I have a site with many pages which have external links pointing to them.
I've renamed many pages on my site.
So now lots of those external links produce 404 pages on my site which is bad.
How can I (.htaccess?) redirect (301) all of those 404 pages to the homepage, so if a link points to http://mydomain.com/invalid_page.html
and that page doesn't exist, I want the user when clicking on that link to get to: http://mydomain.com