Trailing slash with SvelteKit


I read [Support Guide] How can I alter trailing slash behaviour in my URLs? Will enabling Pretty URLs help?, but don’t see the same behavior on our company website.

We have static files, e.g. docs/getting-started/index.html. When deployed, both docs/getting-started and docs/getting-started/ resolve. How do I enforce a redirect from docs/getting-started/ to docs/getting-started (i.e. from / to no /)? Related issue with a linked PR: [docs] 404 error pages with trailing / at the end of url · Issue #552 · gitpod-io/website · GitHub

Our docs pages are Markdown files that get converted to HTML at build time. The reason we want to use no trailing slash is so that we can use relative URLs in the documentation pages. This simplifies navigation when someone reads the docs pages in GitHub.

Any suggestion as to how to redirect / to the URL without trailing slash would be awesome :pray:.



hey @mikenikles , sorry we have been a bit slow to reply! i am going to ask the person who knows most about trailing slashes to weigh in on this when he can, OK? we won’t forget.

Make sure that you have asset optimisation disabled but pretty URLs is ticked. If both the trailing slash and non trailing slash URLs resolve, this is either driven by client-side JS or dynamic routing as part of your SSG.

If you’re still struggling, do you have the site name or app ID you can share?

Thanks for your support. I experimented with various settings and I think the behavior is expected, although not what I want eventually :). It looks like SvelteKit generates index.html files within their own directories.

It’s the “website-kumquat” project in Netlify, the source code is at and the deployed version is at

There’s a new option to configure trailing slahes ( We’ll have to upgrade at some point and see if that resolves the URLs ending with a trailing slash to the URLs without the trailing slash.

For the time being, this support ticket can be closed. Thanks again for your help!


1 Like