Mobile app version of vmapp.org
Login or Join
Gonzalez347

: What is the proper response header when an address is not available but its parent is available and is displayed? My website addresses has a hierarchy structure. When one page is requested,

@Gonzalez347

Posted in: #Headers #HttpHeaders #Url #UserFriendly

My website addresses has a hierarchy structure. When one page is requested, and it is not a valid address, it tries to find its parent, and if the later exists, it will show it. Now, my question is that in this case, should I send a 200 header response or a 404 one? How differently do the search engines react to these headers?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Gonzalez347

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jessie594

I strongly suggest you examine the status codes and their meanings. You did not explain why a client (which could be a human or a bot) might request a URL that does not exist but the URL might have a valid "parent" URL. The reasons for unusual situation will likely guide your choices of status codes.

The information provided by closetnoc is excellent, and I only have a few things to add.


203 might make sense depending on the relationship between the requested material and the served material.
Some status codes are largely for the benefit of humans (like 401), while others are largely for the benefit of bots (like 301). What is your target audience--human, bot, or both?
You might want to return different status codes based on the requesting client. For example, maybe you want search engines (bots) to completely remove the now-gone URL from their database, so you return 410, but you want to keep human users on your site, so you return 201, 301, 303, or 404.
You asked, "should I send a 200 header response[?]" Absolutely not.
"How differently do the search engines react to these headers?" See Google's answer.
Your fundamental issue seems to be link rot. If this is a common issue on your site, you might benefit from learning as much as you can about link rot.

10% popularity Vote Up Vote Down


 

@Nimeshi995

Here is a run-down of some of the HTTP Status Codes.

If you want to know more about HTTP Status Codes, I suggest this page: en.wikipedia.org/wiki/List_of_HTTP_status_codes It explains things rather well.

A 202 status code is OK. This means that the request was successfully fulfilled.
A 301 status code Moved Permanently is a redirect.
A 303 status code See Other is similar to a 301 but rarely used.
A 404 status code is Not Found and the default returned by most if not all web servers.
A 410 is Gone is similar to 404 but not used enough.

Traditionally, the default that a web server returns if a page is not found is a 404 Not Found, however, this means that the page may return so search engines are likely to retry this page for a set number of times. A 410 is used when a page is removed and not expected to return but has to be issued explicitly. Technically, if a page is not expected to return, then a status code of 410 is best.

A 301 status code Moved Permanently is a redirect. However, a 303 status code See Other might be more accurate though not traditionally used. A 301 status code is more widely understood and traditional although you can easily try a 303 and I am reasonably sure it will work okay.

The same applies with a 404 status code. It is widely understood, however, the 410 should work too and seems correct for your scenario.

I would venture to guess that using a 301 and/or 404 are more browser friendly though I am sure most browsers handle 410 and 303 just fine.

Since you are trying to find and present another page, you will want to do 1 of 2 things conditionally whether you are successful in finding another page or not:

If a replacement page is found: Issue a 301 (or 303) redirect to the new page. This is easy enough to do in code.

--or--

If a replacement page is not found: Issue a 404 (or 410). This is easy enough to do in code.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme