I am developing a web site in PHP and I am using mod-rewrite to implement a single point of entry in index.php. From there I am using a dispatch table to dynamically create content for each URL (can be from a DB or other means).
I am not sure what is the correct way to treat URLs that are not in the dispatch table. I would like to return an error page with links to the site root and some possible guesses and a proper 404 code.
I am sure many of you have done such a thing and it is obvious how to do it but searching on google brings in front only results that are not relevant.
Thank you in advance for any solution or link a solution.
Solution up to now:
I am using this
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
just before adding the content of the error page.