Added Status 302 header in redirect()

I do not know why, but without it, my setup was returning a 500 code if the actual http status was something else (404 in my case).

This fix only makes sure that the 302 status (temporary redirect) will be returned to the client.
After all, a call to redirect must really mean that we want a redirect.

Note: I did not used the Page class helpers since this is 'utility' code and I did not wanted to couple utility code to the Page class.
Better logic for handling http status codes

This change makes the error handler a little bit more smarter in the sense that it will try to extract the http status code from the exception it receives. If not status is found, then it reverts to the original implementation that was returning a 500.
Merge pull request #2199 from DeuxHuitHuit/redirect

Make the Error Handler smarter setting HTTP Status. Additionally send 302 Redirect in the redirect() utility function.