Fix range exception on empty query string

When a URL with a empty query string (ex: http://domain.com?) was passed to `canonicalURL:` a range exception was thrown due to `rangeOfString:` returning `{NSNotFound, 0}` and then being passed into `stringByReplacingCharactersInRange:withString:`