Forum OpenACS Development: Re: ADP or TCL for 404 error page

Collapse
Posted by Paul Doerwald on
I've done what's suggested in this thread, but all the pages are returning with HTTP code 200.  I'd like them to return with 404 or 500 so that Google knows what to do when it eventually comes around and indexes the site.

Is there an easy way to set the HTTP response code either by adding a flag for the rp_serve_abstract_file proc, or perhaps by setting the response code inside the templated ADP script?  Is there a way that a script can arbitrarily set a response code?  Something like ad_conn -set (though I don't think that ad_conn lets me do that)

Thanks,

Paul.

Collapse
Posted by Eduardo Pérez on
We would also like to return 404 when the file is not found, because it seems Google needs it for things like Google Sitemaps.

What would be the correct way to return a 404 error code by default when requesting a non existent page?

For example, if you request something like:
https://openacs.org/sadfasdfasfd
You'll get a strange page with comments from nowhere and a 200 OK error code.

Collapse
Posted by Brian Fenton on
You still get "a strange page with comments from nowhere and a 200 OK error code" when you go to https://openacs.org/sadfasdfasfd

Thanks for the tip Dave - I've always had problems getting those AOLserver error pages working (in fact I never have and they've never been enough of a priority - shame on me 😊 - hopefully will get it now).

Brian