What's the most appropriate HTTP status code for an "item not found" error page

ThiefMaster picture ThiefMaster · Apr 9, 2011 · Viewed 97.6k times · Source

I'm curious what's the most appropriate HTTP status code for an "item does not exist" page.

If the page itself doesn't exist, I'll obviously use 404. However, one of my pages has a userid argument (it's an "edit user" page) and in case no user with the given user ID exists I'm displaying an error page, but I'd also like to send a 4xx status header (since "200 OK" doesn't really fit).

I guess 404 would be ok since it's "not found" and not "file not found", but I wonder if there's a better code for this case.

Answer

bmargulies picture bmargulies · Apr 9, 2011

Getting overly clever with obscure-er HTTP error codes is a bad idea. Browsers sometimes react in unhelpful ways that obfuscate the situation. Stick with 404.