My site uses mod rewrite to turn page requests like /item/something/ into /item.php?name=something. Then the php page looks up the name in my database and creates a page based on the database contents.
People however someone might go to a page that does not correlate to an entry in my database, something like /item/not_something/. I want to return a 404 error header if the page does not match.
Right now I have:
if($name... not in database){
header("HTTP/1.0 404 Not Found");
die();
}
I've tested this out, it seems to give the right header and it stops the page from loading but I don't like how it's handled in the web browsers.
In Chrome, I get a gray "Oops! This link appears to be broken." page whereas in the same browser if I type in an address that does not exist (such as /not/anything/) I get a white page that says "Not Found The requested URL /not/anything/ was not found on this server."
Firefox gives me to same type of results.
I was hoping somebody would be able to help me get my item.php page to give the "Not Found" error instead of the "Oops! This link appears to be broken." error.
I do not have a custom 404 implemented on my server.