I have a dynamic page that will GET variables from the URL and check them against a database.
If no article variable is express, a directory loads.
If an article variable is expressed, and this article is in the directory, the article loads.
If an article variable is expressed, but this article is not in the directory, they get an error page suggesting they check their spelling, or go to the article directory.
I plan on sending an error code in the header for this last scenario, but I'm debating which error code I should use.
I would normally assume a 404 error, because that's what I'm use to seeing.
I did some research on w3:
A 404 Error means that the server hasn't found anything that matches the request (which in my case is true).
It continues to say that "no indication is given of whether the condition is temporary or permanent" (which could also be the case because I might add an article in the future that uses that name).
However, it also adds that "this status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable". That seems like a general catch all. I know why the request was refused, maybe there is a better response to give?
On the other hand, a 400 error says that "the request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications".
This seems to be true. The error occurred because of a wrong URL (possibly misspelled), and if you try the request again, you'll get the same error.
The thing is, I've never strayed away from 404s before, and I'm wondering if I'm giving out the wrong code that might have unintended consequences (with browsers, bots or search engines). Which of these codes should I give? Or maybe there is another, more appropriate code.
Any advice is greatly appreciated! Thanks.