Skip to content

Instantly share code, notes, and snippets.

View ialphan's full-sized avatar
💭
Morphing thru time...

Alphan Günaydın ialphan

💭
Morphing thru time...
View GitHub Profile
@ialphan
ialphan / nuxt3-remove-trailing-slash.global.js
Last active February 13, 2024 20:05
Remove trailing slash in nuxt 3
export default function ({path, query, hash}) {
if (path === "/" || !path.endsWith("/")) return;
const nextPath = path.replace(/\/+$/, "") || "/",
nextRoute = {path: nextPath, query, hash};
return navigateTo(nextRoute, {redirectCode: 308});
}