Removing query string before combining URLs