I actually use this (for exemple) in my .htaccess:
ErrorDocument 404 /404.php
And I repeat the line for each error code. I was wondering if there's a way to redirect automatically any http error code and catch this error to reuse it dynamically.