Improve url normalization for edge cases (bug 841093)