Add global error handler and urlrewrite