Proper way to Redirect 404 in PHP

Developers or SEOs handling 404 redirection by many ways.

The proper way is to include the 404-error page and send 404 status code. Then, stop further code execution by exit or die functions.

<?php
if(check_404) {
    header('HTTP/1.1 404 Not Found');
    require_once '404-page.php';
    exit();
}
?>
Note: After 404 redirection the URL of the page must be remain same(http://example.com/my-page.php), Do not change it to (http://example.com/404-page.php).

Remember, improper redirection of 404 by using, header(location: 404-page.php). It just redirect to that page and there is no status code sent.
PHP 404 Redirection Posted on 2016-04-09 06:24:08