404-page in php

This PHP script will let you generate a 404 page with the right HTTP headers for the browser as well as for search engines.

The script is useful eg. if you want to show a "404 Page Not Found" message depending on some condition. It could be if the page is not found, or if the day of the week is Wednesday, or whatever you like.

The script does one thing only: it shows a 404 page. It does so every time the script is called. You can customize the script to have whatever look and/or extra functions you like, feel free to edit as you please.




  1. Download "show_404_page.php.txt" (right click to download)
  2. Rename the file so that the file name ends in ".php".
  3. Optionally, edit the HTML/PHP code (you do not need to, it will work as it is)

The file is now ready for use and will return a 404 when it is requested

The script includes code for the standard Apache 404 error page.

Source code

Just click the Download link (right click to download)

Version and License


Current version: 1


What? Free!