Refactor CGI url building.