[#5658] Fix redirect and path validation