91 check redirect start end appropriately

Fixes the flawed temporary redirect logic and adds tests to ensure that it works.