Fix EZP-22414: Duplicate location header on legacy redirections

This replaces #801 check it out for description and links.

This is a version of the fix reverting #741 before fixing.