I'm looking for a good way to provide a customized 404 (Page not
Found) page for my Typo blogs. I've tried several implementations
myself, but none are satisfactory. I'm more than willing to write the
patch, just need some direction on the best approach.

I've found several places in the trunk that render with a status of
404 like this:

    render '', :status => 404

or

   render :nothing => true, :status => 404

The most relevant 404 seems to be in RedirectController

  render :text => "Page not found", :status => 404

This seems to be what is called for a URL like
http://example.com/blog/this-page-doesnt-exist. These are the sorts of
URLs I'm concerned with.

Ideally, I'd like to create a "Page" in the Typo admin then specify
that that page should be shown for 404s. I don't want to create a
static HTML page, since I'd have to duplicate all the layout HTML and
such.

I don't know whether there's a "render" incantation I can use in
RedirectController that will let me render an action from another
controller with :status => 404. If there is such an incantation, I
haven't found it yet.

For the time being, I've modified RedirectController on my main blog
to do a simple redirect (Cf.
http://seansantry.com/this-page-doesnt-exist), but this is just a
stopgap. It's not configurable through the admin; it requires a
modification to Typo code, as opposed to just a setting; and it gives
the client an HTTP status of 302 followed by a 200 OK. I want the
client to get the proper 404 status.

Thoughts?

- Sean

Reply via email to