0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00
astro/.changeset/blue-spies-shave.md
Matt Kane 536175528d
feat: redirect trailing slashes on on-demand rendered pages (#12994)
Co-authored-by: ematipico <602478+ematipico@users.noreply.github.com>
Co-authored-by: matthewp <361671+matthewp@users.noreply.github.com>
Co-authored-by: sarah11918 <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: bluwy <34116392+bluwy@users.noreply.github.com>
2025-01-29 11:54:15 +00:00

804 B

astro
minor

Redirects trailing slashes for on-demand pages

When the trailingSlash option is set to always or never, on-demand rendered pages will now redirect to the correct URL when the trailing slash doesn't match the configuration option. This was previously the case for static pages, but now works for on-demand pages as well.

Now, it doesn't matter whether your visitor navigates to /about/, /about, or even /about///. In production, they'll always end up on the correct page. For GET requests, the redirect will be a 301 (permanent) redirect, and for all other request methods, it will be a 308 (permanent, and preserve the request method) redirect.

In development, you'll see a helpful 404 page to alert you of a trailing slash mismatch so you can troubleshoot routes.