Add tests for redirects panel.

Also simplify the implementation.