Things get lost, deleted, links point to the wrong location. These things happen. When they do it is best for the user experience to create a useful 404 Not Found page.
Unfortunately, developers will sometimes create a redirect or return a page without the 404 status code. This is called a soft 404 page, and it is bad. Don't do it!
Instead, make your 404 page helpful, but keep that 404 status code.
Creating a custom 404 page is very simple. First, create a page that will function as the 404 page. Then add the following code to your .htaccess file.
ErrorDocument 404 /error/custom404.php
You should change
/error/custom404.php to the location of your 404 page.
You can set custom error pages for more than just 404 errors.
ErrorDocument 401 /error/custom401.php ErrorDocument 403 /error/custom403.php ErrorDocument 404 /error/custom404.php ErrorDocument 500 /error/custom500.php ErrorDocument 502 /error/custom502.php ErrorDocument 503 /error/custom503.php ErrorDocument 504 /error/custom504.php
You should note that if you have a 5XX Server Error your nice error page may not be able to be served. It depends on the exact nature of the error itself. However, you should create them anyway.