There are some WordPress plugins for permanent redirection of all 404’s to the main blog URL (plugin ‘404 Redirection’) or all 404’s to one specified page (plugin ‘404-to-start’).
Also, it can be done by adding following code to the theme’s 404.php page.
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>
I need to redirect all 404’s from one directory to index page of that directory. Does anybody know how this can be done?
Thank you!
tempalte – 404.php