HTTP Headers must be honored
It's a very good idea not getting to a dead end, but search engines need to know there was a 404, also administrator might want to review the logs, the client browser might know there is a broken bookmark, etc.

Comments

drupaloSa’s picture

subscribing

dragonwize’s picture

Priority: Critical » Normal
Status: Active » Closed (works as designed)

404 Not Found header is sent by Drupal if the 404 page is shown.

If you have either of the "goto result.." settings enabled a 302 redirect header is sent and then the user is redirected to the result url and is issued a 200. If there are no results you still get the 404.

This functionality is as it should be because the redirect header must be honored and it is what is really happening. If you want to redirect to real content that is part of the price you pay because the redirect header wins because it is last.

arhak’s picture

this is an old issue, but as I recall having no results didn't redirect neither send the 404 since an empty result page was rendered
anyway, IMO a redirect (302 then 200) only should happen if the targeted content was moved or there is a kind of replacement/equivalent for it, which is not the same as a list of possible results during a search
is an usability issue, I just hate when some sites comes up in search engine results with good ratings and visiting their links drive me to a nice 200 page stating there were no search results for the phrase I'm looking for
If using a Drupal's goto leads to something else than 404 it should be avoided an a result page may be rendered manually with corresponding 404 header.
Don't you think?

dragonwize’s picture

A 404 is given for the search404 results page. Only time a 404 is not given is when you are redirected to a specific post by setting one of those settings.

I am not the developer for this module, so my opinion is just that, an opinion. But for me I think that it is being correctly done as it is now. Personally, showing search results is bad enough when it comes to 404 processing but redirecting to actual content just seems like a bad idea all around.

The search results have some usefulness to the user that I don't see in the redirecting to a real node. The only time that I can see it useful is maybe a retail site that has urls for their products and it will take you there. But it that instance whatever you typed is essentially another way to get to the content. It would be exactly like having a misspelling of your domain name that redirects to your real domain. In both instances, a redirect header is required to tell the search engines and browsers that the redirected url is the real url that they should used instead of what the user originally asked for.

Having a 302 header used instead of a 404 is the price you pay for redirecting to content. Yes only some of your 404's will get a 404 and others will get the 302. But I see that as the same kind of price we pay for having search results on the 404 page. That involved a lot of processing that can take down your site if you are not careful. For this very reason Drupal core ships with the $left and $right regions turned off on error pages. Everything you do as a developer beyond letting your web server handle your errors directly with the standard messages, you are taking consequences in hope for a small gain in another area. Some of those gains are worth it some are not. That is for every site and developer to decide how far they want to go.

arhak’s picture

Status: Closed (works as designed) » Fixed

well, thanks for your detailed response, I agree with you in all senses
this issue was about

A 404 is given for the search404 results page.

which according to you is working properly
I reported this issue last July, now I won't go back there, since I didn't choose to use this module and won't spend time just playing around
Your reply is detailed enough to consider this issue closed
thanks for your time

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.