Changed regex to not append '/' unless url ends in extension