/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-alwaysredirect-bool-4a9af190a9e1-alwaysredirect-boolean-s0304-c0000.md
alwaysRedirect: `boolean` - hono-docs
alwaysRedirect: boolean Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt alwaysredirect boolean Su...
alwaysRedirect: boolean
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#alwaysredirect-boolean
Summary
By default, trailing slash middleware only redirects when the response status is 404. When alwaysRedirect is set to true, the middleware redirects before executing handlers. This is useful for wildcard routes (*) where the defaul...
Content
By default, trailing slash middleware only redirects when the response status is 404. When alwaysRedirect is set to true, the middleware redirects before executing handlers. This is useful for wildcard routes (*) where the default behavior doesn't work.
const app = new Hono()
app.use(trimTrailingSlash({ alwaysRedirect: true }))
app.get('/my-path/*', (c) => c.text('Wildcard route'))This option is available for both trimTrailingSlash and appendTrailingSlash.