Moved relative URL handling added in refs #21177 to a better place.

Thanks apollo13: "reverse() shouldn't know about absolute/relative paths."