if error 404 php code example
Example 1: php create 404 error
<?php
http_response_code(404);
include('my_404.php'); // provide your own HTML for the error page
die();
Example 2: how to check website 404 status in php
<?php
$url = 'http://google.com';
if(@file_get_contents($url)){
echo "Website is up";
} else {
echo "Website is down";
}
?>