Added 301 redirection handling