Shortening if statement and not using a clone of the query string when combining URLs