I was trying to set up my site with google analytics and got this error:
"We've detected that your 404 (file not found) error page returns a status of 200 in the header."

This is because I'm using the search404 page which is redirecting it to the search engine. I think that when redirecting an bad URL that at the very least bots need to be sent the proper headers:
drupal_set_header('HTTP/1.0 404 Not Found');

I like the usability of the search404, but would like to make sure that only valid links get stored with the search engines.

Mike

Comments

marafa’s picture

hi ..
is there a resolution to this problem?
but is this a search404 problem or a drupal core problem?

larssg’s picture

Hi, marafa. It's clearly a problem with Search404 and I agree with mgifford that a 404-header should be returned. I plan to fix this ASAP.

criznach’s picture

It looks like simply adding

drupal_set_header('HTTP/1.0 404 Not Found');

doesn't work.

criznach’s picture

I also tried hooking the search form_alter after the redirect and sending the 404 header from there. It doesn't work, so I'm guessing that for Google to be happy the first response has to be the 404. With the current implementation, there's a 302 redirect to the search page sent first.

One possible solution would be to display the search form and results on the search404 page funciton without redirecting to search/node.

larssg’s picture

I have had a look at this today. I tried simply outputting the HTML from search_data($keys) which this module did once (see http://cvs.drupal.org/viewcvs/drupal/contributions/modules/search404/sea...). This would allow me to send the 404-header, but the previous and next-buttons don't work when I do this.

Any hints, ideas, etc.?

forngren’s picture

Status: Active » Fixed

Fixed in 5.x series http://drupal.org/node/128884

Anonymous’s picture

Status: Fixed » Closed (fixed)