Gravatar de Armonth

How to fix 404 headers on WordPress in order Sitemaps works

This is an english summary from the previous post (in spanish).

In the past, WP-Cache 2.0.17 and above versions cache the Error 404 page (sending the correct header: HTTP 404 Not Found) and next time send the cached page with bad header (HTTP 200 OK). This behavior causes a failure in Google Sitemaps verification.

This bug if fixed in WP-Cache 2.0.18 and newest versions, but WordPress 2.0.6 fails again and send a bad header. This time is not WP-Cache’s fault since disabling cache it does not work for fix this.

The most easier way to fix this behavior and to send the correct header is add three code lines at the begining of the file header.php:

<?php if (is_404()) { 
  header('HTTP/1.0 404 Not Found'); 
} ?>

Drop all cache pages and use this tool or another way to see the headers. You can see this message: “HTTP/1.1 404 Not Found”.

wget -S http://sigt.net/this-page-not-exist/
Petición HTTP enviada, esperando respuesta... 
HTTP/1.1 404 Not Found
...
...
23:06:26 ERROR 404: Not Found.

Works!.

2 Comentarios (feed)

  1. Gravatar de InKiLiNo InKiLiNo nos comenta:

    SigT in inglis, je,je,je,je.. ahora tendriamos que llamarlo NextT :P

    Lunes, 8 de Enero/2007 @ 0:31

  2. Gravatar de Armonth Armonth nos comenta:

    Si fuera algo a menudo, pues sí, pero como sólo es para practicar…

    Lunes, 8 de Enero/2007 @ 11:52

No seas tímido, da tu opinión

Sé respetuoso con los demás, la diferencia de opiniones enriquece la discusión, los comentarios bajo ciertas circunstancias pueden ser moderados y requerir aprobación.