Update redirect code not to add query parameters if they are not present.