I would like to know also as i have changed a site from a blog site to a directory and it would be good do do a redirect to the homepage if anyone uses and old link.
You can use a htaccess file and adding the line: ErrorDocument 404 /index.htm Code (markup): But if you must have a 301 redirect, you can use the above in conjunction with a Redirect, e.g.: Redirect permanent 404.htm http://yoursite.com ErrorDocument 404 /404.htm Code (markup): Not sure if this is the best way and as I don't this and don't recommend it, hence have not looked into different methods of doing this.
Tried it on my site but as the site already uses custom error pages the code does not work oh well never mind.
I got his when I tried it... Not Found The requested URL /blah.php was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.