I have a set of php pages that I use specifically for AJAX requests. I was wonder what would be the best HTTP error code for when the page 开发者_JAVA百科is accessed through a normal request.
I have been using 404 at the moment, but the page does exist.
I was leaning towards either 403 - Forbidden
or 501 - Not Implemented
.
406 Not Acceptable
might be valid in this case.
The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.
I don't think status code matter, you can allow it in all cases, but if you really don't want normal users to access it, I'd use 409 - Conflict
I would use the generic 400 Bad Request status code.
精彩评论