I am using Rails to build a web application. In case a record is not found for a url say http://example.com/city/non_existant_city then I have following code.
render :text => "record was not found", :status => :not_found
In firefox I see the message.
In chrome (on mac) I see a chrome 404 page and this page does not display the message I am sending.
This makes me wonder should I send status as 200. I was sending 404 so that web crawlers can understand that this link is consistently returning 404 so after a while give up on that link.
You should use 404. Not only do crawlers stop visiting invalid links, but you are not penalized for duplicate content if it's a 404 page, as you would if it was a 200.
As for Chrome, it only replaces 404 pages if the contents are too short (less than ~520 chars)
See: http://perso.hirlimann.net/~ludo/blog/archives/2008/09/chrome-and-404s.html
If you're telling the end user that the page doesn't exist, then send a 404.
If you're telling the end user that the page exists, but the record that they were looking for does not, then create a normal page (200) and display an error message in it.
A lot of browsers display "friendly" 404 pages, which is why you aren't seeing your message.
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