You can redirect incorrect URLs to 404 page. First thing you need to create a 404.php file in your activated theme
You need to add the following code as the first line in your 404.php file:
header("HTTP/1.1 301 Moved Permanently"); header("Location: ".'https://www.example.com/page-not-found'); exit();
Next, you need to save the 404.php file and reupload it to your theme directory using FTP or your hosting control panel.
Now, when a page is not found, it will redirect to 404 page.