Added test for redirect loop error (c.f. redmine bug #1936).
Implemented fix for redmine bug #1936 by fixing redirect path.