WordPress: redirect all 404’s from one directory to index page of that directory

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.

Read More
<?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!

Related posts

Leave a Reply

1 comment