How to redirect only 404 pages with htaccess in WordPress

As far I understand, .htaccess rewrite rules are executed before the request is proccesed by WordPress, or even by PHP engine, so you can not know if a URL will trigger a 404 error in .htaccess, you can not check if a given path will trigger a 404 at that level. You need to do it in WordPress itself:

// See https://developer.wordpress.org/reference/hooks/template_redirect/
add_action( 'template_redirect', 'cyb_redirect_not_found_paths' );
function cyb_redirect_not_found_paths() {

    // See https://developer.wordpress.org/reference/functions/is_404/
    if( is_404() ) {

        if( $_SERVER['REQUEST_URI'] == '/your_path' ) {

            $url_to = 'redirecton_rul';

            // See https://developer.wordpress.org/reference/functions/wp_redirect/
            wp_redirect( $url_to );
            exit;

        }

    }

}