Ruby on Rails
DynamicErrorPagesWish

I wish that the 404 and 500 pages were rhtml pages, not just html. I want to be able to include my layouts with dynamic content in my error pages.

Well than change your .htaccess from

ErrorDocument 404 /404.html

to :
ErrorDocument 404 /articles/show/404 

or something like this.

I wouldn’t recommend to do this with 500s because they usually mean application error and tus the application would have similar trouble to display your 500 page.
—TobiasLuetke


For the 404’s or 403’s you can use

<meta http-equiv="refresh" content="0;url=/content/not_found">

in your 404.html. As TobiasLuetke said, you do not want to do this for 500.html.


What about creating a route that maps *path_bits to your error controller/action? Make sure it’s the route with lowest priority(ie. the last one)

See an example of this approach in the article Taking care of old links by RyanCarver.
LeeO


Another reason for modifying the 500 would be for troubleshooting an unknown, remember that you can look in the log/development.log file for help.