Correctly handle redirects