added on-fail function as alternative to redirect
Merge pull request #69 from yogthos/master

added on-fail option for redirects