Fixed query validation for empty query objects + Allow www in URL hostname

There was an error in the query validation function that attached the "?" prefix when query strings where present. Empty objects are parsed as true in the conditional if. I've fixed the validation, and also allowed www in the URL host, as some (misconfigured) hosts don't work when trying to reach them without the www.