Redirect to /404/

So you can do something like this:

  1. Open the 404.php file and add these lines to the top of it. If you don’t have one, create it. This will ensure WordPress uses this file for all permalinks that no longer exist or never existed.
    <?php 
    /**
    * Template Name: 404 Page
    */
    
    $four_oh_four = get_permalink( get_page_by_path( '404' ) );
    wp_redirect( $four_oh_four );
    exit();
  1. Create a page with slug ‘404’.The above code will now redirect from the regular 404 template to a page with ‘404’ slug.

I haven’t tested it but should work.

Optionally, you could also use PHP’s default redirection using headers if you want to. I just used WordPress’ redirection API.