Forum Moderators: phranque
If someone were to type a nonsense url into the address bar like h*tp://widgets.com/foo-widgets/ my page returns a "No records found message"
This is because in my PHP page I check the record count of the query if there are records I display them, if not I just say "no records found"
It's not a big deal unless unless I change the data in the database. It seems like the search engines will keep indexing orphaned pages nowadays.
Would it not be wiser to return a 404 error?
How would I do this? I believe I would need to buffer the response and then issue a 404.
How have others handled this?
if(!isset($result) OR empty($result)) { header($_SERVER['SERVER_PROTOCOL']." 404 Not Found"); exit(); }
For the full message, see this thread (Msg. #15 & #17):
404 URL's [webmasterworld.com]
Justin