Which response header is correct

I have a real estate website where property details are dynamically generated using PHP MySQL. When a property is removed from the database (sold) I currently redirect the url for the removed property to a separate page which says the property is sold etc etc using a 301 redirect.

My question is should the sold page I am redirecting to show a 200, 410 or 404 response header?

TIA

200

The removed property page could conceivably use 410 or 404, but the sold page should certainly be 200.

CH,

I’ll vote for 301 as the correct answer because you have a permanent redirect for that property, i.e., SOLD.

410 shows that the requested page is “Gone” which is true, 200 would be my next choice (but it NOT correct) and 404 is not found (it is found, just sold).

Regards,

DK

Once the property is sold it is effectively removed from the site so the only way of finding it is from a search engine link. Ideally this link needs to be removed from the search engine results. If I give the page a 200 or 301 response will it then remain in the search engine results?

The sold page contains a generic message saying property sold with a link to the site property search page. Not much point in this being added to the search results so is a 200 or 301 really the way to go?

Just thinking aloud here always ready to accept more experienced advice on this.

thanks

Why not give it a “Gone” and redirect to a “search for similar” or “recommended alternatives” type of page?

I have it with a “gone” at the moment and GWT reports numerous soft 404’s as a result :frowning:

Or from bookmarks or other links out on the web. :wink:

200… This response code means the request succeeded and would imply that the property page is still there. This isn’t what you want for the removed property page.

301… getting warming. This response code means moved permanently. A browser or search engine would still be expecting to find the property page, just at a new location. This doesn’t quite match your scenario either.

404 Not Found or 410 Gone seems to be the most appropriate. The only difference between the two is caching. 410 is considered permanent and therefore cacheable.

But now you also need to show the user the sold page. You have a couple options for that. You could send the sold page content as the response body along with the 404/410 response code. The response code would be there for the search engine to read, and the response body would be there for the user to read. I think this is your best option.

Your other option is to send a Location header along with your 404/410 response. The location header will make the browser redirect to your generic sold page. The sold page itself would be a normal page and issue a 200 response.

If you don’t want the generic sold page to be indexed by Google, then you should use robots.txt to accomplish that.

So I think I have really got this wrong!

Currently if you hit on a sold property page, call it property1.php, this is what happens:

property1.php queries the db and finds no results so that page then returns a 301 redirect response and you are redirected to sold.php which gives a 410 gone response.

I think it should go like this:

property1.php queries the db and finds no results so that page then returns a 410/404 response with Location header and you are redirected to sold.php which gives a 200 response.

OK thanks for all your input I will go with “property1.php queries the db and finds no results so that page then returns a 410/404 response with Location header and you are redirected to sold.php which gives a 200 response.”

Thanks again