I have pages with structure like this some_page?id=123
Sometimes records are deleted, but those pages still get visited by people and search engines. One problem is that I have a php script and no MVC structure, so I have to query the DB all on the same page before I find out that the user record does not exist.
Should I return a 404 in that case? Or what is best practice?
Thanks!
If the client (users, search engines, etc.) requests a resource that does not exist and has never existed, a 404 status ("Not Found") should be returned.
However, if a resource is requested that once existed and has since been permanently removed, a 410 status ("Gone") should be returned. A 410 status specifically states that the resource will never be available in the future, and triggers search engines to remove that page from their indexes.
A 301 status is used if a resource's location has changed permanently.
A 404 is when something is not found and since the resource being looked up is not found, it seems entirely appropriate to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With