Handle and test for redirect loops