Handling 301 and 302 callbacks