[wp-hackers] Should Monthly Archive Pages ever return 404?

Heiko Rabe heiko.rabe at code-styling.de
Mon Mar 9 20:21:20 GMT 2009


I think, if you want to separate a 404 failed call reason from your 
use-case, it's not valid to use 200 status code.

For your reason (no content available but request still accepted and 
done) you will need status code:

204  No Content

permitted for  HTTP/1.0     HTTP/1.1     WebDAV

stating that the request has been successful done (2xx range) but no 
content has been provided yet.

If you want to support external services, give them a chance to 
differentiate between 200 (that it is) and 204 (have no further data).

regards

Heiko Rabe
(www.code-styling.de)

> "Casey Bisson" <casey.bisson at gmail.com> wrote:
>   
>> Are you arguing that the page shouldn't return a 404, or 
>> that WP should implement some more elegant hooks to handle 
>> 404 conditions?
>>     
>
> The former is admittedly a long debate that would probably never be resolved to everyone's satisfaction and with significant bikeshedding.
>
> So the latter is probably the best approach.
>
>   
>> You should take a look inside the WP_Query object. It's 
>> written to parse every possible legal request URL, and 
>> if you hook into in the right places, you'll also find 
>> opportunities to generate more useful 404s when either 
>> the query parser fails or if the database returns no  
>> results (as is the case with your example).
>>     
>
> Thanks. I've review it but will give it another look.  
>
> That said, a question; does it allow me to say "Don't generate a 404, just continue on and run the archive page as you would for any month where there are posts?"  Otherwise I'll likely have to write some very convoluted code to get the results I'm looking for.  And if it doesn't I'll happily write the patch to improve it is someone can suggest what branch of code to patch?
>
> -Mike Schinkel
> http://mikeschinkel.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>   



More information about the wp-hackers mailing list