Accounts for possible trailing slash in location.search