I have a problem with trailing slash at the end of my routes! I'm using headless CMS and My vue-router version is 3.6.5.
By the way I used:
trailingSlash: false
in my router option, In addition I've used
strict: false
in my router options too!
But still I have no inbounds links problem with SEO tools and the trailing slash is coz of it! after this changes I still have trailing slash in my links.
and In addition I've used beforeEach and afterEach for my router!
router.beforeEach((to, from, next) => {
const _to = to.fullPath.replace(/\/$/, "");
//const _from = from.fullPath.replace(/\/$/, "");
//const _current = window.location.pathname.replace(/\/$/, "");
const flag = _to !== "" && to.fullPath && to.fullPath.match(/\/$/);
if (flag) {
let _to2 = "";
for (let i = 1; i < to.fullPath.split(/\//).length - 1; i++) {
_to2 += "/" + to.fullPath.split(/\//)[i];
}
next(_to2);
} else next();
});
This code the request will come to DOM and after that it will remove the slash at the end of the URL and because of this the SEO tool will not recognize this!
still nothing! any other solution?