Implement redirect() function.