Redirect inconsistent urls middleware for koa.
-
www
vsnon-www
. - Trailing slash vs no trailing slash.
var consistentUrls = require('koa-consistent-urls')
var Koa = require('koa')
var app = new Koa()
app.use(consistentUrls({
www: false,
trailingSlash: false,
}))
Options are:
Whether or not to prepend the hostname with www.
. Fix & redirect if the request url doesn't match.
true
: Force www.
on the hostname.
false
: Remove www.
from hostname.
Default: false
.
Whether or not to append a trailing slash (/
) on the pathname. Fix & redirect if the request url doesn't match.
true
: Force trailing slash (/
) on the pathname.
false
: Remove trailing slash (/
) from pathname.
Default: false
.
TODO
. Feel free to PR.