- PHP

How to make a 404 page in PHP

To create a 404 page in PHP:

  • Set the valid 404 response code with http_response_code(404).
  • Include the 404 file or echo some content like “Error 404, page not found”.

Example:

<?php

http_response_code(404);
include('your404file.php');

?>