correct url resolve on click

When resolving url, make sure that the last / is removed only when necess...