handling redirects for paths that end in slashes