: Can an HTTP status 400 be a substitute for a 410? As I shift many URL's on my site from non-friendly to friendly, I came across an old URL that was used for testing that google later ended
As I shift many URL's on my site from non-friendly to friendly, I came across an old URL that was used for testing that google later ended up scanning but now I no longer use the URL. Its in the unfriendly form like this:
example.com/something.php?something=something&
In the past, that URL matched another on my site and in order to rectify it, I had to change the status code (and make the URL not return an actual webpage). At first I thought using the code 410 to indicate gone to google, but now I figured http status 400 is better because all my other "clean" URLs never contain an & in them and http status 400 stands for malformed request.
Is this an acceptable practice? or should I just convert it to http status 410? What would search engines think of this practice? (I'm just trying to follow standards here)
More posts by @Angela700
3 Comments
Sorted by latest first Latest Oldest Best
Malformed request doesn't mean "a URL you don't have a resource for". It means malformed request. HTTP 400 is definitely wrong here.
HTTP 410 works well as it indicates that a previously accessible resource no longer is.
Your alternative, as others have mentioned, would be a 404.
Officially, yes. Any 4xx status may be interpreted as 400; the same goes for the other status groups. (E.g. a 503 service unavailable error may be interpreted as a 500 internal server error.)
The RFC is written this way to allow for implementations that may not support every status, and also to allow additional status codes to be defined without breaking backwards compatibility.
So yes, you may use 400 instead of 410. However, you should use the most accurate status available to you to describe the current state; if the resource is gone, isn't ever coming back, and can't (to your knowledge) be found anywhere else, 410 is the appropriate status. I'd probably use 404 before 400.
The reference for this behaviour is RFC 7231 (HTTP 1.1: Semantics and Content), Section 6. (Note that RFC 7231 and others supersede RFC 2616.)
Why 410 gone?
Since the page once existed the correct header status return would be 410 gone, this will inform Google and other search engines to drop the page from its index. You should avoid using status 400 bad request since this implies the server did not understand the request due to malformed syntax. Using undesirable status codes will populate your error logs and can make fault finding harder on actual issues.
What about 404?
Using either a 404 or 410 statuses is considered ok, however… if you know the page is never coming back then its best to use a 410 gone. Google has said that they treat the outcome of 404 and 410 the same but the 410 is dropped quicker due to the fact that 404’s can occur when it’s not intended.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.